diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-05-29 11:54:49 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-29 11:54:49 +0900 |
| commit | fd7b77c542b51313d8b8ea60124725fe65a295d5 (patch) | |
| tree | 78893fdfe273496831124414789376b1e2a18997 /packages/backend/src/daemons | |
| parent | pnpm devでCtrl+Cで終了させてもプロセスが完全に殺せないの... (diff) | |
| download | sharkey-fd7b77c542b51313d8b8ea60124725fe65a295d5.tar.gz sharkey-fd7b77c542b51313d8b8ea60124725fe65a295d5.tar.bz2 sharkey-fd7b77c542b51313d8b8ea60124725fe65a295d5.zip | |
enhance(backend): migrate bull to bullmq (#10910)
* wip
* wip
* Update QueueService.ts
* wip
* refactor
* :v:
* fix
* Update QueueStatsService.ts
* refactor
* Update ApNoteService.ts
* Update mock-resolver.ts
* refactor
* Update mock-resolver.ts
Diffstat (limited to 'packages/backend/src/daemons')
| -rw-r--r-- | packages/backend/src/daemons/QueueStatsService.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/packages/backend/src/daemons/QueueStatsService.ts b/packages/backend/src/daemons/QueueStatsService.ts index b717434e09..0a5b3184d2 100644 --- a/packages/backend/src/daemons/QueueStatsService.ts +++ b/packages/backend/src/daemons/QueueStatsService.ts @@ -1,7 +1,11 @@ -import { Injectable } from '@nestjs/common'; +import { Inject, Injectable } from '@nestjs/common'; import Xev from 'xev'; +import * as Bull from 'bullmq'; import { QueueService } from '@/core/QueueService.js'; import { bindThis } from '@/decorators.js'; +import { DI } from '@/di-symbols.js'; +import type { Config } from '@/config.js'; +import { QUEUE, baseQueueOptions } from '@/queue/const.js'; import type { OnApplicationShutdown } from '@nestjs/common'; const ev = new Xev(); @@ -13,6 +17,9 @@ export class QueueStatsService implements OnApplicationShutdown { private intervalId: NodeJS.Timer; constructor( + @Inject(DI.config) + private config: Config, + private queueService: QueueService, ) { } @@ -31,11 +38,14 @@ export class QueueStatsService implements OnApplicationShutdown { let activeDeliverJobs = 0; let activeInboxJobs = 0; - this.queueService.deliverQueue.on('global:active', () => { + const deliverQueueEvents = new Bull.QueueEvents(QUEUE.DELIVER, baseQueueOptions(this.config, QUEUE.DELIVER)); + const inboxQueueEvents = new Bull.QueueEvents(QUEUE.INBOX, baseQueueOptions(this.config, QUEUE.INBOX)); + + deliverQueueEvents.on('active', () => { activeDeliverJobs++; }); - this.queueService.inboxQueue.on('global:active', () => { + inboxQueueEvents.on('active', () => { activeInboxJobs++; }); |