|
|
@ -207,6 +207,7 @@ export class AttachmentMigration { |
|
|
|
|
|
|
|
|
|
|
|
if (isExternal) { |
|
|
|
if (isExternal) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
this.log(`Checking connection for ${source_id} (${source.alias})`); |
|
|
|
// run SELECT 1 to check if connection is working
|
|
|
|
// run SELECT 1 to check if connection is working
|
|
|
|
// return if no response in 10 seconds
|
|
|
|
// return if no response in 10 seconds
|
|
|
|
await Promise.race([ |
|
|
|
await Promise.race([ |
|
|
@ -215,6 +216,10 @@ export class AttachmentMigration { |
|
|
|
setTimeout(() => reject(new Error('timeout')), 10000), |
|
|
|
setTimeout(() => reject(new Error('timeout')), 10000), |
|
|
|
), |
|
|
|
), |
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.log( |
|
|
|
|
|
|
|
`External source ${source_id} (${source.alias}) is accessible`, |
|
|
|
|
|
|
|
); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
this.log( |
|
|
|
this.log( |
|
|
|
`External source ${source_id} (${source.alias}) is not accessible`, |
|
|
|
`External source ${source_id} (${source.alias}) is not accessible`, |
|
|
@ -425,7 +430,8 @@ export class AttachmentMigration { |
|
|
|
updatePayload.push(updateData); |
|
|
|
updatePayload.push(updateData); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (updatePayload.length > 0) { |
|
|
|
// TODO: enable external updates for production
|
|
|
|
|
|
|
|
if (updatePayload.length > 0 && !isExternal) { |
|
|
|
for (const updateData of updatePayload) { |
|
|
|
for (const updateData of updatePayload) { |
|
|
|
const wherePk = await baseModel._wherePk( |
|
|
|
const wherePk = await baseModel._wherePk( |
|
|
|
baseModel._extractPksValues(updateData), |
|
|
|
baseModel._extractPksValues(updateData), |
|
|
|