Browse Source

fix: add timeout before starting job to allow socket instance to receive all messages

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/4705/head
mertmit 2 years ago
parent
commit
bcfb68b6fb
  1. 19
      packages/nocodb/src/lib/meta/api/sync/importApis.ts

19
packages/nocodb/src/lib/meta/api/sync/importApis.ts

@ -107,14 +107,17 @@ export default (
baseURL = `http://localhost:${process.env.PORT || 8080}`;
}
NocoJobs.jobsMgr.add<AirtableSyncConfig>(AIRTABLE_IMPORT_JOB, {
id: req.params.syncId,
...(syncSource?.details || {}),
projectId: syncSource.project_id,
baseId: syncSource.base_id,
authToken: token,
baseURL,
});
setTimeout(() => {
NocoJobs.jobsMgr.add<AirtableSyncConfig>(AIRTABLE_IMPORT_JOB, {
id: req.params.syncId,
...(syncSource?.details || {}),
projectId: syncSource.project_id,
baseId: syncSource.base_id,
authToken: token,
baseURL,
});
}, 1000);
jobs[req.params.syncId] = {
last_message: {
msg: 'Sync started',

Loading…
Cancel
Save