aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-timers-unrefd-interval-still-fires.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-01-08 21:17:53 -0800
committerRich Trott <rtrott@gmail.com>2016-01-11 09:24:04 -0800
commite071894202c49d1dc50c80e05cb667468ce68ac2 (patch)
treeb60c9753517622b0936fb5dc1f72baa76b632d8e /test/parallel/test-timers-unrefd-interval-still-fires.js
parentd7c5110a79b2fdfd5457999292717b74c2d48dba (diff)
downloadandroid-node-v8-e071894202c49d1dc50c80e05cb667468ce68ac2.tar.gz
android-node-v8-e071894202c49d1dc50c80e05cb667468ce68ac2.tar.bz2
android-node-v8-e071894202c49d1dc50c80e05cb667468ce68ac2.zip
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>
Diffstat (limited to 'test/parallel/test-timers-unrefd-interval-still-fires.js')
-rw-r--r--test/parallel/test-timers-unrefd-interval-still-fires.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/parallel/test-timers-unrefd-interval-still-fires.js b/test/parallel/test-timers-unrefd-interval-still-fires.js
index 8f26d28816..172da8bb95 100644
--- a/test/parallel/test-timers-unrefd-interval-still-fires.js
+++ b/test/parallel/test-timers-unrefd-interval-still-fires.js
@@ -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(() => {
@@ -20,7 +20,7 @@ const timer = setInterval(() => {
timer._onTimeout = () => {
throw new Error('Unrefd interval fired after being cleared.');
};
- setImmediate(() => clearTimeout(keepOpen));
+ clearTimeout(keepOpen);
}
}, 1);