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:
parent
4b67ffe11b
commit
691ef2cc6a
1 changed files with 10 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue