From c5dda1d62d02729aa7d79f5d8bc7a1743aa81bed Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Wed, 5 Apr 2023 16:37:25 -0700 Subject: [PATCH] Reduce job queue shutdown timeout --- ts/background.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ts/background.ts b/ts/background.ts index dfff1fdd4..373da8843 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -740,11 +740,13 @@ export async function startApp(): Promise { sleeper.shutdown(); const shutdownQueues = async () => { + log.info('background/shutdown: shutting down queues'); await Promise.allSettled([ StartupQueue.shutdown(), shutdownAllJobQueues(), ]); + log.info('background/shutdown: shutting down conversation queues'); await Promise.allSettled( window.ConversationController.getAll().map(async convo => { try { @@ -757,9 +759,11 @@ export async function startApp(): Promise { } }) ); + + log.info('background/shutdown: all queues shutdown'); }; - // wait for at most 2 minutes for startup queue and job queues to drain + // wait for at most 1 minutes for startup queue and job queues to drain let timeout: NodeJS.Timeout | undefined; await Promise.race([ shutdownQueues(), @@ -770,7 +774,7 @@ export async function startApp(): Promise { ); timeout = undefined; resolve(); - }, 2 * MINUTE); + }, 1 * MINUTE); }), ]); if (timeout) {