Skip to content

Commit b4a3abd

Browse files
dgp1130atscott
authored andcommitted
test(platform-server): replace fixed timeout with polling in event replay test
This test appears to be flakey in CI, presumably because resource constrained environments can run unexpected slower and exceed the timeout. This switches to a polling approach, waiting for the queue to drain.
1 parent 47cd604 commit b4a3abd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/platform-server/test/event_replay_spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -792,11 +792,11 @@ describe('event replay', () => {
792792
// Eventually it should be empty again.
793793
// Since `invokeRegisteredReplayListeners` triggers hydration directly and pushes to queue.
794794

795-
// We can inspect the queue if we want.
796-
// But mainly we want to ensure no crash and cleanup happens.
797-
798795
// wait for replay
799-
await new Promise((resolve) => setTimeout(resolve, 100));
796+
const start = Date.now();
797+
while (queue.length > 0 && Date.now() - start < 1_000) {
798+
await new Promise((resolve) => setTimeout(resolve, 10));
799+
}
800800
expect(queue.length).toBe(0);
801801
});
802802

0 commit comments

Comments
 (0)