From c8d7aed2ceda365a717443aaf92da4223bc514d1 Mon Sep 17 00:00:00 2001 From: mertmit Date: Tue, 7 Nov 2023 16:37:17 +0000 Subject: [PATCH] refactor: job name --- packages/nocodb/src/interface/Jobs.ts | 6 +++--- .../src/modules/jobs/fallback/fallback-queue.service.ts | 4 ++-- .../jobs/jobs/source-create/source-create.controller.ts | 4 ++-- .../jobs/jobs/source-create/source-create.processor.ts | 2 +- .../jobs/jobs/source-delete/source-delete.controller.ts | 4 ++-- .../jobs/jobs/source-delete/source-delete.processor.ts | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/nocodb/src/interface/Jobs.ts b/packages/nocodb/src/interface/Jobs.ts index 9bda48a9c5..ca0dadbaec 100644 --- a/packages/nocodb/src/interface/Jobs.ts +++ b/packages/nocodb/src/interface/Jobs.ts @@ -1,12 +1,12 @@ export const JOBS_QUEUE = 'jobs'; export enum JobTypes { - DuplicateBase = 'duplicate-source', + DuplicateBase = 'duplicate-base', DuplicateModel = 'duplicate-model', AtImport = 'at-import', MetaSync = 'meta-sync', - BaseCreate = 'base-create', - BaseDelete = 'base-delete', + SourceCreate = 'source-create', + SourceDelete = 'source-delete', UpdateModelStat = 'update-model-stat', UpdateWsStat = 'update-ws-stats', UpdateSrcStat = 'update-source-stat', diff --git a/packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts b/packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts index b921bf3415..6f51b6d31e 100644 --- a/packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts +++ b/packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts @@ -76,11 +76,11 @@ export class QueueService { this: this.metaSyncProcessor, fn: this.metaSyncProcessor.job, }, - [JobTypes.BaseCreate]: { + [JobTypes.SourceCreate]: { this: this.sourceCreateProcessor, fn: this.sourceCreateProcessor.job, }, - [JobTypes.BaseDelete]: { + [JobTypes.SourceDelete]: { this: this.sourceDeleteProcessor, fn: this.sourceDeleteProcessor.job, }, diff --git a/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts b/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts index ac81599c1c..26143419d4 100644 --- a/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts +++ b/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts @@ -33,7 +33,7 @@ export class SourceCreateController { ) { const jobs = await this.jobsService.jobList(); const fnd = jobs.find( - (j) => j.name === JobTypes.BaseCreate && j.data.baseId === baseId, + (j) => j.name === JobTypes.SourceCreate && j.data.baseId === baseId, ); if (fnd) { @@ -42,7 +42,7 @@ export class SourceCreateController { ); } - const job = await this.jobsService.add(JobTypes.BaseCreate, { + const job = await this.jobsService.add(JobTypes.SourceCreate, { baseId, source: body, req: { diff --git a/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.processor.ts b/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.processor.ts index 3064006906..cd5b9bfdac 100644 --- a/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.processor.ts +++ b/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.processor.ts @@ -14,7 +14,7 @@ export class SourceCreateProcessor { private readonly jobsLogService: JobsLogService, ) {} - @Process(JobTypes.BaseCreate) + @Process(JobTypes.SourceCreate) async job(job: Job) { this.debugLog(`job started for ${job.id}`); diff --git a/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts b/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts index e5a0e61f99..ad60bdd746 100644 --- a/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts +++ b/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts @@ -29,7 +29,7 @@ export class SourceDeleteController { async baseDelete(@Param('sourceId') sourceId: string, @Req() req) { const jobs = await this.jobsService.jobList(); const fnd = jobs.find( - (j) => j.name === JobTypes.BaseDelete && j.data.sourceId === sourceId, + (j) => j.name === JobTypes.SourceDelete && j.data.sourceId === sourceId, ); if (fnd) { @@ -38,7 +38,7 @@ export class SourceDeleteController { await this.sourcesService.baseSoftDelete({ sourceId }); - const job = await this.jobsService.add(JobTypes.BaseDelete, { + const job = await this.jobsService.add(JobTypes.SourceDelete, { sourceId, req: { user: req.user, diff --git a/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts b/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts index 83bdec03d3..6547bc2d22 100644 --- a/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts +++ b/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts @@ -10,7 +10,7 @@ export class SourceDeleteProcessor { constructor(private readonly sourcesService: SourcesService) {} - @Process(JobTypes.BaseDelete) + @Process(JobTypes.SourceDelete) async job(job: Job) { this.debugLog(`job started for ${job.id}`);