test: fix flaky unrefed timers test
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: https://github.com/nodejs/node/issues/4559 PR-URL: https://github.com/nodejs/node/pull/4599 Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
This commit is contained in:
parent
d7c5110a79
commit
e071894202
@ -5,7 +5,7 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
|
||||||
const TEST_DURATION = common.platformTimeout(100);
|
const TEST_DURATION = common.platformTimeout(100);
|
||||||
const N = 5;
|
const N = 3;
|
||||||
var nbIntervalFired = 0;
|
var nbIntervalFired = 0;
|
||||||
|
|
||||||
const keepOpen = setTimeout(() => {
|
const keepOpen = setTimeout(() => {
|
||||||
@ -20,7 +20,7 @@ const timer = setInterval(() => {
|
|||||||
timer._onTimeout = () => {
|
timer._onTimeout = () => {
|
||||||
throw new Error('Unrefd interval fired after being cleared.');
|
throw new Error('Unrefd interval fired after being cleared.');
|
||||||
};
|
};
|
||||||
setImmediate(() => clearTimeout(keepOpen));
|
clearTimeout(keepOpen);
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user