From 556703d531837b0f12192b99f5f027a84a11ba31 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 8 Jan 2016 21:17:53 -0800 Subject: [PATCH] test: fix flaky unrefed timers test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- test/parallel/test-timers-unrefd-interval-still-fires.js | 4 ++-- 1 file 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 8f26d28816b60c..172da8bb954fa7 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);