Skip to content

Commit 749eaaf

Browse files
committed
Tighten shutdown exit ordering
1 parent c5add83 commit 749eaaf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/shutdown.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ function ensureShutdownHandler(): void {
6464
}
6565
signalExitPending = true;
6666
let exitRequested = false;
67-
let timeoutHandle: ReturnType<typeof setTimeout> | null = setTimeout(() => {
68-
requestExit();
69-
}, SIGNAL_CLEANUP_TIMEOUT_MS);
7067
const requestExit = () => {
7168
if (exitRequested) {
7269
return;
@@ -78,6 +75,9 @@ function ensureShutdownHandler(): void {
7875
}
7976
process.exit(0);
8077
};
78+
let timeoutHandle: ReturnType<typeof setTimeout> | null = setTimeout(() => {
79+
requestExit();
80+
}, SIGNAL_CLEANUP_TIMEOUT_MS);
8181
void runCleanup().finally(() => {
8282
requestExit();
8383
});

0 commit comments

Comments
 (0)