diff --git a/packages/backend/src/core/QueueModule.ts b/packages/backend/src/core/QueueModule.ts index 08e63cfef4..2f594394a6 100644 --- a/packages/backend/src/core/QueueModule.ts +++ b/packages/backend/src/core/QueueModule.ts @@ -10,6 +10,8 @@ import type { Config } from '@/config.js'; import { baseQueueOptions, QUEUE } from '@/queue/const.js'; import { allSettled } from '@/misc/promise-tracker.js'; import Logger from '@/logger.js'; +import { bindThis } from '@/decorators.js'; +import { renderInlineError } from '@/misc/render-inline-error.js'; import { DeliverJobData, EndedPollNotificationJobData, @@ -142,7 +144,7 @@ export class QueueModule implements OnApplicationShutdown { await allSettled(); // And then close all queues this.logger.info('Closing BullMQ queues...'); - await Promise.all([ + await Promise.allSettled([ this.systemQueue.close(), this.endedPollNotificationQueue.close(), this.deliverQueue.close(), @@ -153,7 +155,13 @@ export class QueueModule implements OnApplicationShutdown { this.userWebhookDeliverQueue.close(), this.systemWebhookDeliverQueue.close(), this.scheduleNotePostQueue.close(), - ]); + ]).then(res => { + for (const result of res) { + if (result.status === 'rejected') { + this.logger.error(`Error closing queue: ${renderInlineError(result.reason)}`); + } + } + }); this.logger.info('Queue module disposed.'); }