1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

chore(kv) fix flaky queue test (#19495)

This commit is contained in:
Igor Zinkovsky 2023-06-14 07:14:32 -07:00 committed by GitHub
parent 4b67ffe11b
commit 691ef2cc6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1698,9 +1698,9 @@ Deno.test({
Deno.test({
name: "queue persistence with delay messages",
sanitizeOps: false,
sanitizeResources: false,
async fn() {
const dispatchedPre = Deno.metrics().opsDispatchedAsync;
const completedPre = Deno.metrics().opsCompletedAsync;
const filename = "cli/tests/testdata/queue.db";
try {
await Deno.remove(filename);
@ -1745,6 +1745,14 @@ Deno.test({
db.close();
await listener;
} finally {
// Wait until callbacks are drained before deleting the db.
let dispatched = Deno.metrics().opsDispatchedAsync - dispatchedPre;
let completed = Deno.metrics().opsCompletedAsync - completedPre;
while (dispatched !== completed) {
dispatched = Deno.metrics().opsDispatchedAsync - dispatchedPre;
completed = Deno.metrics().opsCompletedAsync - completedPre;
await sleep(100);
}
await Deno.remove(filename);
}
},