diff options
| author | Marie <marie@kaifa.ch> | 2024-01-09 02:57:57 +0100 |
|---|---|---|
| committer | Marie <marie@kaifa.ch> | 2024-01-09 02:57:57 +0100 |
| commit | 7552cea69ae21b31799d54b246dcd45e96654926 (patch) | |
| tree | 389031f25fee72180157869a9e60c31704e198a9 /packages/backend/src/core/QueueModule.ts | |
| parent | merge: additional authorised fetch logging (#328) (diff) | |
| parent | feat(ci): api.jsonのバリデーションチェックCIを追加 (#12950) (diff) | |
| download | sharkey-7552cea69ae21b31799d54b246dcd45e96654926.tar.gz sharkey-7552cea69ae21b31799d54b246dcd45e96654926.tar.bz2 sharkey-7552cea69ae21b31799d54b246dcd45e96654926.zip | |
merge: upstream
Diffstat (limited to 'packages/backend/src/core/QueueModule.ts')
| -rw-r--r-- | packages/backend/src/core/QueueModule.ts | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/packages/backend/src/core/QueueModule.ts b/packages/backend/src/core/QueueModule.ts index 4444dc9787..20a53ff282 100644 --- a/packages/backend/src/core/QueueModule.ts +++ b/packages/backend/src/core/QueueModule.ts @@ -3,12 +3,12 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { setTimeout } from 'node:timers/promises'; import { Inject, Module, OnApplicationShutdown } from '@nestjs/common'; import * as Bull from 'bullmq'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import { QUEUE, baseQueueOptions } from '@/queue/const.js'; +import { allSettled } from '@/misc/promise-tracker.js'; import type { Provider } from '@nestjs/common'; import type { DeliverJobData, InboxJobData, EndedPollNotificationJobData, WebhookDeliverJobData, RelationshipJobData } from '../queue/types.js'; @@ -106,14 +106,9 @@ export class QueueModule implements OnApplicationShutdown { ) {} public async dispose(): Promise<void> { - if (process.env.NODE_ENV === 'test') { - // XXX: - // Shutting down the existing connections causes errors on Jest as - // Misskey has asynchronous postgres/redis connections that are not - // awaited. - // Let's wait for some random time for them to finish. - await setTimeout(5000); - } + // Wait for all potential queue jobs + await allSettled(); + // And then close all queues await Promise.all([ this.systemQueue.close(), this.endedPollNotificationQueue.close(), |