Browse Source

fix: job queue constant

Signed-off-by: mertmit <mertmit99@gmail.com>
feat/export-nest-dir-restructure
mertmit 2 years ago committed by starbirdtech383
parent
commit
51f0a5ed79
  1. 2
      packages/nocodb-nest/src/interface/Jobs.ts
  2. 4
      packages/nocodb-nest/src/modules/jobs/at-import/at-import.controller.ts
  3. 4
      packages/nocodb-nest/src/modules/jobs/at-import/at-import.processor.ts
  4. 4
      packages/nocodb-nest/src/modules/jobs/export-import/duplicate.controller.ts
  5. 4
      packages/nocodb-nest/src/modules/jobs/export-import/duplicate.processor.ts
  6. 3
      packages/nocodb-nest/src/modules/jobs/jobs-event.service.ts
  7. 3
      packages/nocodb-nest/src/modules/jobs/jobs.module.ts
  8. 3
      packages/nocodb-nest/src/modules/jobs/jobs.service.ts

2
packages/nocodb-nest/src/interface/Jobs.ts

@ -1,3 +1,5 @@
export const JOBS_QUEUE = 'jobs';
export enum JobTypes {
DuplicateBase = 'duplicate-base',
DuplicateModel = 'duplicate-model',

4
packages/nocodb-nest/src/modules/jobs/at-import/at-import.controller.ts

@ -7,14 +7,14 @@ import { SyncSource } from '../../../models';
import { NcError } from '../../../helpers/catchError';
import { QueueService } from '../fallback-queue.service';
import { JobsService } from '../jobs.service';
import { JobTypes } from '../../../interface/Jobs';
import { JOBS_QUEUE, JobTypes } from '../../../interface/Jobs';
@Controller()
@UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
export class AtImportController {
activeQueue;
constructor(
@InjectQueue('jobs') private readonly jobsQueue: Queue,
@InjectQueue(JOBS_QUEUE) private readonly jobsQueue: Queue,
private readonly fallbackQueueService: QueueService,
private readonly jobsService: JobsService,
) {

4
packages/nocodb-nest/src/modules/jobs/at-import/at-import.processor.ts

@ -25,7 +25,7 @@ import { ViewColumnsService } from '../../../services/view-columns.service';
import { ViewsService } from '../../../services/views.service';
import { FormsService } from '../../../services/forms.service';
import { JobsEventService } from '../jobs-event.service';
import { JobTypes } from '../../../interface/Jobs';
import { JOBS_QUEUE, JobTypes } from '../../../interface/Jobs';
import FetchAT from './helpers/fetchAT';
import { importData, importLTARData } from './helpers/readAndProcessData';
import EntityMap from './helpers/EntityMap';
@ -82,7 +82,7 @@ const selectColors = {
grayDarker: '#444',
};
@Processor('jobs')
@Processor(JOBS_QUEUE)
export class AtImportProcessor {
constructor(
private readonly tablesService: TablesService,

4
packages/nocodb-nest/src/modules/jobs/export-import/duplicate.controller.ts

@ -18,14 +18,14 @@ import { ProjectsService } from '../../../services/projects.service';
import { Base, Project } from '../../../models';
import { generateUniqueName } from '../../../helpers/exportImportHelpers';
import { QueueService } from '../fallback-queue.service';
import { JobTypes } from '../../../interface/Jobs';
import { JOBS_QUEUE, JobTypes } from '../../../interface/Jobs';
@Controller()
@UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
export class DuplicateController {
activeQueue;
constructor(
@InjectQueue('jobs') private readonly jobsQueue: Queue,
@InjectQueue(JOBS_QUEUE) private readonly jobsQueue: Queue,
private readonly fallbackQueueService: QueueService,
private readonly projectsService: ProjectsService,
) {

4
packages/nocodb-nest/src/modules/jobs/export-import/duplicate.processor.ts

@ -6,14 +6,14 @@ import { Base, Column, Model, Project } from '../../../models';
import { ProjectsService } from '../../../services/projects.service';
import { findWithIdentifier } from '../../../helpers/exportImportHelpers';
import { BulkDataAliasService } from '../../../services/bulk-data-alias.service';
import { JobTypes } from '../../../interface/Jobs';
import { JOBS_QUEUE, JobTypes } from '../../../interface/Jobs';
import { ExportService } from './export.service';
import { ImportService } from './import.service';
import type { LinkToAnotherRecordColumn } from '../../../models';
const DEBUG = false;
@Processor('jobs')
@Processor(JOBS_QUEUE)
export class DuplicateProcessor {
constructor(
private readonly exportService: ExportService,

3
packages/nocodb-nest/src/modules/jobs/jobs-event.service.ts

@ -7,8 +7,9 @@ import {
import { Job } from 'bull';
import boxen from 'boxen';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { JOBS_QUEUE } from '../../interface/Jobs';
@Processor('jobs')
@Processor(JOBS_QUEUE)
export class JobsEventService {
constructor(private eventEmitter: EventEmitter2) {}

3
packages/nocodb-nest/src/modules/jobs/jobs.module.ts

@ -3,6 +3,7 @@ import { BullModule } from '@nestjs/bull';
import { GlobalModule } from '../global/global.module';
import { DatasModule } from '../datas/datas.module';
import { MetasModule } from '../metas/metas.module';
import { JOBS_QUEUE } from '../../interface/Jobs';
import { JobsService } from './jobs.service';
import { ExportService } from './export-import/export.service';
import { ImportService } from './export-import/import.service';
@ -20,7 +21,7 @@ import { AtImportProcessor } from './at-import/at-import.processor';
DatasModule,
MetasModule,
BullModule.registerQueue({
name: 'jobs',
name: JOBS_QUEUE,
}),
],
controllers: [DuplicateController, AtImportController],

3
packages/nocodb-nest/src/modules/jobs/jobs.service.ts

@ -1,13 +1,14 @@
import { InjectQueue } from '@nestjs/bull';
import { Injectable } from '@nestjs/common';
import { Queue } from 'bull';
import { JOBS_QUEUE } from '../../interface/Jobs';
import { QueueService } from './fallback-queue.service';
@Injectable()
export class JobsService {
activeQueue;
constructor(
@InjectQueue('jobs') private readonly jobsQueue: Queue,
@InjectQueue(JOBS_QUEUE) private readonly jobsQueue: Queue,
private readonly fallbackQueueService: QueueService,
) {
this.activeQueue = process.env.NC_REDIS_URL

Loading…
Cancel
Save