This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -464,7 +464,9 @@ export class Miniflare {
464464 verbose : this . #sharedOpts. core . verbose ,
465465 } ;
466466 this . #runtime = new Runtime ( opts ) ;
467- this . #removeRuntimeExitHook = exitHook ( ( ) => void this . #runtime?. dispose ( ) ) ;
467+ this . #removeRuntimeExitHook = exitHook (
468+ ( ) => void this . #runtime?. dispose ( /* force */ true )
469+ ) ;
468470
469471 // Update config and wait for runtime to start
470472 await this . #assembleAndUpdateConfig( /* initial */ true ) ;
Original file line number Diff line number Diff line change @@ -134,14 +134,14 @@ export class Runtime {
134134 return this . #processExitPromise;
135135 }
136136
137- dispose ( ) : Awaitable < void > {
137+ dispose ( force = false ) : Awaitable < void > {
138138 // `kill()` uses `SIGTERM` by default. In `workerd`, this waits for HTTP
139139 // connections to close before exiting. Notably, Chrome sometimes keeps
140140 // connections open for about 10s, blocking exit. We'd like `dispose()`/
141141 // `setOptions()` to immediately terminate the existing process.
142142 // Therefore, use `SIGINT` which force closes all connections.
143143 // See https://github.com/cloudflare/workerd/pull/244.
144- this . #process?. kill ( "SIGINT" ) ;
144+ this . #process?. kill ( force ? "SIGKILL" : "SIGINT" ) ;
145145 return this . #processExitPromise;
146146 }
147147}
You can’t perform that action at this time.
0 commit comments