From 687a9395889c2653449c0453e35a12b889c56519 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Mon, 8 May 2023 09:52:56 +0200 Subject: fix(ext/http): Ensure Deno.serve works across --watch restarts (#18998) Fixes #16699 and #18960 by ensuring that we release our HTTP `spawn_local` tasks when the HTTP resource is dropped. Because our cancel handle was being projected from the resource via `RcMap`, the resource was never `Drop`ped. By splitting the handle out into its own `Rc`, we can avoid keeping the resource alive and let it drop to cancel everything. --- cli/tests/unit/serve_test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cli/tests/unit') diff --git a/cli/tests/unit/serve_test.ts b/cli/tests/unit/serve_test.ts index 5d5d0428f..ce7267f58 100644 --- a/cli/tests/unit/serve_test.ts +++ b/cli/tests/unit/serve_test.ts @@ -94,8 +94,9 @@ Deno.test(async function httpServerRejectsOnAddrInUse() { onListen: onListen(listeningPromise), onError: createOnErrorCb(ac), }); + await listeningPromise; - assertRejects( + await assertRejects( () => Deno.serve({ handler: (_req) => new Response("ok"), -- cgit v1.2.3