Skip to content

Commit

Permalink
Fix test flake in js-rpc-socket-test, introduced in #2764.
Browse files Browse the repository at this point in the history
  • Loading branch information
kentonv committed Sep 23, 2024
1 parent a0b780f commit 2513840
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/workerd/api/tests/js-rpc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,13 @@ export let disposal = {
let counter = new MyCounter(3);
await env.MyService.leakButReturnPlainObject(counter);

// Give a chance for disposal to happen.
await scheduler.wait(10);
// Give a chance for disposal to happen. When running with a real socket, this involves
// non-deterministic scheduling, and it can be relatively slower when running under ASAN,
// QEMU, etc. so we'll try to dynamically adjust how much time we wait, up to 10s.
for (let i = 0; i < 1000; i++) {
if (counter.disposed) break;
await scheduler.wait(10);
}

// It should have happened! A call that returns a plain object should NOT
// require disposal to clean up its context!
Expand Down

0 comments on commit 2513840

Please sign in to comment.