Browse Source

feat: continue to read from import data api during bulk insert procedure

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/2218/head
Raju Udava 2 years ago committed by Pranav C
parent
commit
41027aafbb
  1. 5
      packages/nocodb/src/lib/noco/meta/api/sync/helpers/readAndProcessData.ts

5
packages/nocodb/src/lib/noco/meta/api/sync/helpers/readAndProcessData.ts

@ -32,6 +32,7 @@ async function readAllData({
}; };
if (fields) selectParams.fields = fields; if (fields) selectParams.fields = fields;
const insertJobs: Promise<any>[] = [];
base(table.title) base(table.title)
.select(selectParams) .select(selectParams)
@ -48,7 +49,8 @@ async function readAllData({
); );
if (thresholdCbkData.length >= triggerThreshold) { if (thresholdCbkData.length >= triggerThreshold) {
await onThreshold(thresholdCbkData, data); await Promise.all(insertJobs);
insertJobs.push(onThreshold(thresholdCbkData, data));
thresholdCbkData = []; thresholdCbkData = [];
} }
@ -63,6 +65,7 @@ async function readAllData({
return reject(err); return reject(err);
} }
if (thresholdCbkData.length) { if (thresholdCbkData.length) {
await Promise.all(insertJobs);
await onThreshold(thresholdCbkData, data); await onThreshold(thresholdCbkData, data);
thresholdCbkData = []; thresholdCbkData = [];
} }

Loading…
Cancel
Save