From ec49d6af3f4007fbfffba1f1cd52b4a9c8237541 Mon Sep 17 00:00:00 2001 From: Dihak Date: Fri, 15 May 2026 00:56:05 +0700 Subject: [PATCH] fix(process-cleanup): call process.exit() after SIGTERM cleanup scheduleForcedExit was called without exitAfterCleanup=true for SIGTERM/SIGINT. After cleanup completed, timeout cleared but process.exit() never called. Process stayed alive waiting for event loop to drain. Benchmark (systemctl stop): - Before: 10s+ timeout (systemd had to SIGKILL) - After: ~30ms instant shutdown Test results (3 runs): - Test 1: 30ms - Test 2: 28ms - Test 3: 27ms --- src/features/background-agent/process-cleanup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/background-agent/process-cleanup.ts b/src/features/background-agent/process-cleanup.ts index d08890825..2d60ac15d 100644 --- a/src/features/background-agent/process-cleanup.ts +++ b/src/features/background-agent/process-cleanup.ts @@ -40,7 +40,7 @@ function registerProcessSignal( const listener = () => { const cleanupResult = handler() if (exitAfter) { - scheduleForcedExit(cleanupResult, 0) + scheduleForcedExit(cleanupResult, 0, true) } } process.on(signal, listener)