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 <[email protected]>
  • Loading branch information
Trott authored and Myles Borins committed Jan 11, 2016
1 parent 7ba6a71 commit 36b385d
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
Original file line number Diff line number Diff line change
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 36b385d

Please sign in to comment.