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
This commit is contained in:
Dihak
2026-05-15 00:56:05 +07:00
parent bd2f10551e
commit ec49d6af3f
@@ -40,7 +40,7 @@ function registerProcessSignal(
const listener = () => {
const cleanupResult = handler()
if (exitAfter) {
scheduleForcedExit(cleanupResult, 0)
scheduleForcedExit(cleanupResult, 0, true)
}
}
process.on(signal, listener)