Browse Source

fix: remove job on complete

nc-fix/wh-followup
mertmit 6 months ago
parent
commit
591ea44758
  1. 6
      packages/nocodb/src/modules/jobs/jobs.controller.ts
  2. 4
      packages/nocodb/src/modules/jobs/redis/jobs.service.ts

6
packages/nocodb/src/modules/jobs/jobs.controller.ts

@ -112,7 +112,11 @@ export class JobsController {
) {
await JobsRedis.unsubscribe(jobId);
delete this.jobRooms[jobId];
this.closedJobs.push(jobId);
// close the job after 1 second (to allow the update of messages)
setTimeout(() => {
this.closedJobs.push(jobId);
}, 1000);
// remove the job after polling interval * 2
setTimeout(() => {
this.closedJobs = this.closedJobs.filter((j) => j !== jobId);
}, POLLING_INTERVAL * 2);

4
packages/nocodb/src/modules/jobs/redis/jobs.service.ts

@ -46,7 +46,9 @@ export class JobsService implements OnModuleInit {
async add(name: string, data: any) {
await this.toggleQueue();
const job = await this.jobsQueue.add(name, data);
const job = await this.jobsQueue.add(name, data, {
removeOnComplete: true,
});
return job;
}

Loading…
Cancel
Save