chore: change the quota sync to the queue 2
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { BullModule } from "@nestjs/bullmq";
|
||||
import { Module } from "@nestjs/common";
|
||||
import { Module, OnModuleInit } from "@nestjs/common";
|
||||
|
||||
import { QUOTA_SYNC_QUEUE } from "./constants";
|
||||
import { QuotaSyncProcessor } from "./queue/quota-sync.processor";
|
||||
@@ -12,13 +12,16 @@ import { MailServerModule } from "../mail-server/mail-server.module";
|
||||
BullModule.registerQueue({
|
||||
name: QUOTA_SYNC_QUEUE.QUEUE_NAME,
|
||||
prefix: QUOTA_SYNC_QUEUE.QUEUE_PREFIX,
|
||||
defaultJobOptions: {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true,
|
||||
},
|
||||
}),
|
||||
],
|
||||
providers: [QuotaSyncService, QuotaSyncProcessor],
|
||||
exports: [QuotaSyncService],
|
||||
})
|
||||
export class QuotaSyncModule {}
|
||||
export class QuotaSyncModule implements OnModuleInit {
|
||||
constructor(private readonly quotaSyncService: QuotaSyncService) {}
|
||||
|
||||
async onModuleInit() {
|
||||
// Setup the cron job when the module initializes
|
||||
await this.quotaSyncService.setupCronJob();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user