Skip to content

Commit c9b56ac

Browse files
authored
Close pools (#72)
* fix: Close requests pools on termination * Add changeset
1 parent d2d6cd2 commit c9b56ac

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/metal-rabbits-camp.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@valtown/deno-http-worker": patch
3+
---
4+
5+
Close request pools when terminating workers

src/DenoHTTPWorker.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ class denoHTTPWorker implements DenoHTTPWorker {
337337
forceKill(this.#process.pid!);
338338
}
339339

340+
await this.#pool.close();
341+
340342
fs.rm(this.#socketFile).catch(() => {});
341343
for (const onexit of this.#onexitListeners) {
342344
onexit(code ?? 1, signal ?? "");
@@ -352,6 +354,7 @@ class denoHTTPWorker implements DenoHTTPWorker {
352354
await new Promise<void>((res) => {
353355
this.#process.on("exit", res);
354356
});
357+
await this.#pool.close();
355358
}
356359

357360
async websocket(

0 commit comments

Comments
 (0)