Browse Source

fix: remove job on complete

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

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

@ -112,7 +112,11 @@ export class JobsController {
) { ) {
await JobsRedis.unsubscribe(jobId); await JobsRedis.unsubscribe(jobId);
delete this.jobRooms[jobId]; delete this.jobRooms[jobId];
// close the job after 1 second (to allow the update of messages)
setTimeout(() => {
this.closedJobs.push(jobId); this.closedJobs.push(jobId);
}, 1000);
// remove the job after polling interval * 2
setTimeout(() => { setTimeout(() => {
this.closedJobs = this.closedJobs.filter((j) => j !== jobId); this.closedJobs = this.closedJobs.filter((j) => j !== jobId);
}, POLLING_INTERVAL * 2); }, 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) { async add(name: string, data: any) {
await this.toggleQueue(); await this.toggleQueue();
const job = await this.jobsQueue.add(name, data); const job = await this.jobsQueue.add(name, data, {
removeOnComplete: true,
});
return job; return job;
} }

Loading…
Cancel
Save