Skip to content

Commit 7e1f610

Browse files
apapirovskiaddaleax
authored andcommitted
test: fix flaky test-domain-timers
It's possible for this test to be extremely infrequently flaky if 1ms or more elapses between setting the two timeouts. In that case, the second timer will not fire and the test will fail. PR-URL: #21019 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Weijia Wang <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]>
1 parent 2bbd99c commit 7e1f610

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/parallel/test-domain-timers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const timeoutd = domain.create();
2828

2929
timeoutd.on('error', common.mustCall(function(e) {
3030
assert.strictEqual(e.message, 'Timeout UNREFd');
31-
clearTimeout(timeout);
3231
}, 2));
3332

3433
let t;
@@ -38,6 +37,7 @@ timeoutd.run(function() {
3837
}, 0).unref();
3938

4039
t = setTimeout(function() {
40+
clearTimeout(timeout);
4141
throw new Error('Timeout UNREFd');
4242
}, 0);
4343
});

0 commit comments

Comments
 (0)