From 41027aafbba8b35e52586c1adb46222c2d8193a0 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Tue, 31 May 2022 22:04:42 +0530 Subject: [PATCH] feat: continue to read from import data api during bulk insert procedure Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../src/lib/noco/meta/api/sync/helpers/readAndProcessData.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/lib/noco/meta/api/sync/helpers/readAndProcessData.ts b/packages/nocodb/src/lib/noco/meta/api/sync/helpers/readAndProcessData.ts index bd6a8c7b70..2d69e39b69 100644 --- a/packages/nocodb/src/lib/noco/meta/api/sync/helpers/readAndProcessData.ts +++ b/packages/nocodb/src/lib/noco/meta/api/sync/helpers/readAndProcessData.ts @@ -32,6 +32,7 @@ async function readAllData({ }; if (fields) selectParams.fields = fields; + const insertJobs: Promise[] = []; base(table.title) .select(selectParams) @@ -48,7 +49,8 @@ async function readAllData({ ); if (thresholdCbkData.length >= triggerThreshold) { - await onThreshold(thresholdCbkData, data); + await Promise.all(insertJobs); + insertJobs.push(onThreshold(thresholdCbkData, data)); thresholdCbkData = []; } @@ -63,6 +65,7 @@ async function readAllData({ return reject(err); } if (thresholdCbkData.length) { + await Promise.all(insertJobs); await onThreshold(thresholdCbkData, data); thresholdCbkData = []; }