Navigation Menu

Skip to content

Commit

Permalink
test: fix flaky unrefed timers test
Browse files Browse the repository at this point in the history
Remove unnecessary `setImmediate()` that causes a minor race condition.
Stop the test after 3 occurrences rather than 5 to allow for slower
hosts running the test in parallel with other tests.

Fixes: #4559
PR-URL: #4599
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
  • Loading branch information
Trott authored and Myles Borins committed Feb 15, 2016
1 parent 15fa555 commit 556703d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-timers-unrefd-interval-still-fires.js
Expand Up @@ -5,7 +5,7 @@
const common = require('../common');

const TEST_DURATION = common.platformTimeout(100);
const N = 5;
const N = 3;
var nbIntervalFired = 0;

const keepOpen = setTimeout(() => {
Expand All @@ -20,7 +20,7 @@ const timer = setInterval(() => {
timer._onTimeout = () => {
throw new Error('Unrefd interval fired after being cleared.');
};
setImmediate(() => clearTimeout(keepOpen));
clearTimeout(keepOpen);
}
}, 1);

Expand Down

0 comments on commit 556703d

Please sign in to comment.