Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 41fe830

Browse files
committed
test: Fix SubscriberResends uncontrolled setTimeout.
1 parent 47e2c81 commit 41fe830

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/integration/SubscriberResends.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,15 @@ describeRepeats('resends', () => {
162162
await client.publish(emptyStream.id, msg)
163163

164164
const received = []
165+
let t
165166
for await (const m of sub) {
166167
received.push(m.getParsedContent())
167-
setTimeout(() => {
168+
clearTimeout(t)
169+
t = setTimeout(() => {
168170
sub.cancel()
169171
}, 250)
170172
}
173+
clearTimeout(t)
171174

172175
expect(onResent).toHaveBeenCalledTimes(1)
173176
expect(received).toEqual([msg])

0 commit comments

Comments
 (0)