Browse Source

fix: external source handling

nc-feat/attachment-clean-up
mertmit 4 months ago
parent
commit
ff31f2298a
  1. 20
      packages/nocodb/src/modules/jobs/migration-jobs/nc_job_001_attachment.ts

20
packages/nocodb/src/modules/jobs/migration-jobs/nc_job_001_attachment.ts

@ -169,6 +169,8 @@ export class AttachmentMigration {
return;
}
const isExternal = !source.isMeta();
const model = await Model.get(context, fk_model_id);
if (!model) {
@ -189,6 +191,24 @@ export class AttachmentMigration {
return;
}
if (isExternal) {
try {
// run SELECT 1 to check if connection is working
// return if no response in 10 seconds
await Promise.race([
dbDriver.raw('SELECT 1'),
new Promise((resolve, reject) =>
setTimeout(() => reject(new Error('timeout')), 10000),
),
]);
} catch (e) {
this.log(
`External source ${source_id} (${source.alias}) is not accessible`,
);
return;
}
}
const baseModel = await Model.getBaseModelSQL(context, {
model,
dbDriver,

Loading…
Cancel
Save