Browse Source

refactor: job name

pull/6910/head
mertmit 1 year ago
parent
commit
c8d7aed2ce
  1. 6
      packages/nocodb/src/interface/Jobs.ts
  2. 4
      packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  3. 4
      packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts
  4. 2
      packages/nocodb/src/modules/jobs/jobs/source-create/source-create.processor.ts
  5. 4
      packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts
  6. 2
      packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts

6
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',

4
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,
},

4
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: {

2
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}`);

4
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,

2
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}`);

Loading…
Cancel
Save