enhance(backend): migrate bull to bullmq (#10910)
* wip
* wip
* Update QueueService.ts
* wip
* refactor
* ✌️
* fix
* Update QueueStatsService.ts
* refactor
* Update ApNoteService.ts
* Update mock-resolver.ts
* refactor
* Update mock-resolver.ts
			
			
This commit is contained in:
		| @@ -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++; | ||||
| 		}); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 syuilo
					syuilo