This commit is contained in:
NoriDev 2024-10-31 13:52:01 +09:00 committed by Marie
parent 92ffd2a5fc
commit 2528508cff
No known key found for this signature in database
GPG key ID: 7ADF6C9CD9A28555
41 changed files with 1455 additions and 6 deletions

View file

@ -16,6 +16,7 @@ import {
RelationshipJobData,
UserWebhookDeliverJobData,
SystemWebhookDeliverJobData,
ScheduleNotePostJobData,
} from '../queue/types.js';
import type { Provider } from '@nestjs/common';
@ -28,6 +29,7 @@ export type RelationshipQueue = Bull.Queue<RelationshipJobData>;
export type ObjectStorageQueue = Bull.Queue;
export type UserWebhookDeliverQueue = Bull.Queue<UserWebhookDeliverJobData>;
export type SystemWebhookDeliverQueue = Bull.Queue<SystemWebhookDeliverJobData>;
export type ScheduleNotePostQueue = Bull.Queue<ScheduleNotePostJobData>;
const $system: Provider = {
provide: 'queue:system',
@ -83,6 +85,12 @@ const $systemWebhookDeliver: Provider = {
inject: [DI.config],
};
const $scheduleNotePost: Provider = {
provide: 'queue:scheduleNotePost',
useFactory: (config: Config) => new Bull.Queue(QUEUE.SCHEDULE_NOTE_POST, baseQueueOptions(config, QUEUE.SCHEDULE_NOTE_POST)),
inject: [DI.config],
};
@Module({
imports: [
],
@ -96,6 +104,7 @@ const $systemWebhookDeliver: Provider = {
$objectStorage,
$userWebhookDeliver,
$systemWebhookDeliver,
$scheduleNotePost,
],
exports: [
$system,
@ -107,6 +116,7 @@ const $systemWebhookDeliver: Provider = {
$objectStorage,
$userWebhookDeliver,
$systemWebhookDeliver,
$scheduleNotePost,
],
})
export class QueueModule implements OnApplicationShutdown {
@ -120,6 +130,7 @@ export class QueueModule implements OnApplicationShutdown {
@Inject('queue:objectStorage') public objectStorageQueue: ObjectStorageQueue,
@Inject('queue:userWebhookDeliver') public userWebhookDeliverQueue: UserWebhookDeliverQueue,
@Inject('queue:systemWebhookDeliver') public systemWebhookDeliverQueue: SystemWebhookDeliverQueue,
@Inject('queue:scheduleNotePost') public scheduleNotePostQueue: ScheduleNotePostQueue,
) {}
public async dispose(): Promise<void> {
@ -136,6 +147,7 @@ export class QueueModule implements OnApplicationShutdown {
this.objectStorageQueue.close(),
this.userWebhookDeliverQueue.close(),
this.systemWebhookDeliverQueue.close(),
this.scheduleNotePostQueue.close(),
]);
}