From 9065937d2c5f3c44c2df2142785def7bd68532af Mon Sep 17 00:00:00 2001 From: Boki Date: Fri, 20 Jun 2025 18:42:16 -0400 Subject: [PATCH] fixed shutdown not working sometimes --- libs/shutdown/src/shutdown.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/shutdown/src/shutdown.ts b/libs/shutdown/src/shutdown.ts index b0a6043..051232f 100644 --- a/libs/shutdown/src/shutdown.ts +++ b/libs/shutdown/src/shutdown.ts @@ -172,11 +172,13 @@ export class Shutdown { process.platform === 'win32' ? ['SIGINT', 'SIGTERM'] : ['SIGTERM', 'SIGINT', 'SIGUSR2']; signals.forEach(signal => { - process.once(signal, () => { - // Changed from 'on' to 'once' to prevent multiple handlers - this.shutdownAndExit(signal).catch(() => { - process.exit(1); - }); + process.on(signal, () => { + // Only process if not already shutting down + if (!this.isShuttingDown) { + this.shutdownAndExit(signal).catch(() => { + process.exit(1); + }); + } }); });