Skip to content

Commit ec8b1df

Browse files
committed
Use SIGINT when killing runtime process
`kill()` uses `SIGTERM` by default. In `workerd`, this waits for HTTP connections to close before exiting. Notably, Chrome sometimes keeps connections open for about 10s, blocking exit. We'd like `dispose()`/ `setOptions()` to immediately terminate the existing process. Therefore, use `SIGINT` which force closes all connections. Ref: cloudflare/workerd#244
1 parent d0695ad commit ec8b1df

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/miniflare/src/runtime/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ class NativeRuntime extends Runtime {
134134
}
135135

136136
dispose(): Awaitable<void> {
137-
this.#process?.kill();
137+
// `kill()` uses `SIGTERM` by default. In `workerd`, this waits for HTTP
138+
// connections to close before exiting. Notably, Chrome sometimes keeps
139+
// connections open for about 10s, blocking exit. We'd like `dispose()`/
140+
// `setOptions()` to immediately terminate the existing process.
141+
// Therefore, use `SIGINT` which force closes all connections.
142+
// See https://github.com/cloudflare/workerd/pull/244.
143+
this.#process?.kill("SIGINT");
138144
return this.#processExitPromise;
139145
}
140146
}

0 commit comments

Comments
 (0)