|
|
|
@ -25,6 +25,7 @@ import {
|
|
|
|
|
import { JobsRedis } from '~/modules/jobs/redis/jobs-redis'; |
|
|
|
|
import { InstanceCommands } from '~/interface/Jobs'; |
|
|
|
|
import { deepMerge, partialExtract } from '~/utils'; |
|
|
|
|
import View from '~/models/View'; |
|
|
|
|
|
|
|
|
|
export default class Source implements SourceType { |
|
|
|
|
id?: string; |
|
|
|
@ -201,6 +202,11 @@ export default class Source implements SourceType {
|
|
|
|
|
prepareForResponse(updateObj), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// trigger cache clear and don't wait
|
|
|
|
|
this.updateRelatedCaches(context, sourceId, ncMeta).catch((e) => { |
|
|
|
|
console.error(e); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (JobsRedis.available) { |
|
|
|
|
await JobsRedis.emitWorkerCommand(InstanceCommands.RELEASE, sourceId); |
|
|
|
|
await JobsRedis.emitPrimaryCommand(InstanceCommands.RELEASE, sourceId); |
|
|
|
@ -566,4 +572,22 @@ export default class Source implements SourceType {
|
|
|
|
|
`${MetaTable.INTEGRATIONS}.id`, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static async updateRelatedCaches( |
|
|
|
|
context: NcContext, |
|
|
|
|
sourceId: string, |
|
|
|
|
ncMeta = Noco.ncMeta, |
|
|
|
|
) { |
|
|
|
|
// get models
|
|
|
|
|
const models = await Model.list( |
|
|
|
|
context, |
|
|
|
|
{ source_id: sourceId, base_id: context.base_id }, |
|
|
|
|
ncMeta, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// clear single query caches for models
|
|
|
|
|
for (const model of models) { |
|
|
|
|
await View.clearSingleQueryCache(context, model.id, null, ncMeta); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|