From f0a022bed4c8ca46c472c6361f1793cb29f73480 Mon Sep 17 00:00:00 2001 From: Igor Zinkovsky Date: Tue, 26 Sep 2023 20:06:57 -0700 Subject: fix(kv_queues): graceful shutdown (#20627) This fixes the `TypeError: Database closed` error during shutdown. --- cli/tests/unit/kv_test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cli') diff --git a/cli/tests/unit/kv_test.ts b/cli/tests/unit/kv_test.ts index da5dba6af..25abf4cde 100644 --- a/cli/tests/unit/kv_test.ts +++ b/cli/tests/unit/kv_test.ts @@ -1819,6 +1819,16 @@ Deno.test({ }, }); +Deno.test({ + name: "queue graceful close", + async fn() { + const db: Deno.Kv = await Deno.openKv(":memory:"); + const listener = db.listenQueue((_msg) => {}); + db.close(); + await listener; + }, +}); + dbTest("atomic operation is exposed", (db) => { assert(Deno.AtomicOperation); const ao = db.atomic(); -- cgit v1.2.3