mirror of
https://github.com/nocodb/nocodb.git
synced 2026-06-01 23:42:42 +00:00
fix: concurrency
This commit is contained in:
@@ -3319,12 +3319,22 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {
|
||||
undo: param?.undo,
|
||||
});
|
||||
|
||||
await this.runOps(preInsertOps.map((f) => f()));
|
||||
// Cap in-flight preInsertOps so many nested LTAR capture SELECTs
|
||||
// don't saturate the knex pool. Mutating closures only build
|
||||
// .toQuery() strings (no connection), so the cap mainly limits
|
||||
// the capture-SELECT side. Resolved strings are handed back to
|
||||
// runOps to keep its serial UPDATE/DELETE walk.
|
||||
const preInsertResolved = await processConcurrently(
|
||||
preInsertOps,
|
||||
(f) => f(),
|
||||
5,
|
||||
);
|
||||
await this.runOps(preInsertResolved.map((s) => Promise.resolve(s)));
|
||||
|
||||
// Deposit displacement capture for the trace decorator.
|
||||
// `displacedRecords` was populated by capture-ops in
|
||||
// preInsertOps (parallel SELECTs ran during Promise.all,
|
||||
// before runOps walked the UPDATE/DELETE strings serially).
|
||||
// preInsertOps (SELECTs ran under the concurrency cap above,
|
||||
// before runOps walked the resulting UPDATE/DELETE strings serially).
|
||||
// Skipped under replay — replay reads from meta.extra, doesn't
|
||||
// re-capture.
|
||||
if (displacedRecords.length > 0 && !isReplay()) {
|
||||
|
||||
@@ -61,8 +61,6 @@ const up = async (knex: Knex) => {
|
||||
['fk_user_id', 'tab_id', 'scope_type', 'scope_id', 'status', 'seq'],
|
||||
'nc_op_logs_user_tab_scope_status_seq_idx',
|
||||
);
|
||||
// Cleanup queries (per-workspace pruning, TTL sweeps).
|
||||
table.index(['fk_workspace_id', 'base_id'], 'nc_op_logs_ws_base_idx');
|
||||
table.index(['cleanup_due_at'], 'nc_op_logs_cleanup_due_at_idx');
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user