Reduce job queue shutdown timeout
This commit is contained in:
parent
4a18667ddf
commit
c5dda1d62d
1 changed files with 6 additions and 2 deletions
|
@ -740,11 +740,13 @@ export async function startApp(): Promise<void> {
|
||||||
sleeper.shutdown();
|
sleeper.shutdown();
|
||||||
|
|
||||||
const shutdownQueues = async () => {
|
const shutdownQueues = async () => {
|
||||||
|
log.info('background/shutdown: shutting down queues');
|
||||||
await Promise.allSettled([
|
await Promise.allSettled([
|
||||||
StartupQueue.shutdown(),
|
StartupQueue.shutdown(),
|
||||||
shutdownAllJobQueues(),
|
shutdownAllJobQueues(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
log.info('background/shutdown: shutting down conversation queues');
|
||||||
await Promise.allSettled(
|
await Promise.allSettled(
|
||||||
window.ConversationController.getAll().map(async convo => {
|
window.ConversationController.getAll().map(async convo => {
|
||||||
try {
|
try {
|
||||||
|
@ -757,9 +759,11 @@ export async function startApp(): Promise<void> {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
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;
|
let timeout: NodeJS.Timeout | undefined;
|
||||||
await Promise.race([
|
await Promise.race([
|
||||||
shutdownQueues(),
|
shutdownQueues(),
|
||||||
|
@ -770,7 +774,7 @@ export async function startApp(): Promise<void> {
|
||||||
);
|
);
|
||||||
timeout = undefined;
|
timeout = undefined;
|
||||||
resolve();
|
resolve();
|
||||||
}, 2 * MINUTE);
|
}, 1 * MINUTE);
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue