-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
timers: don't close interval timers when unrefd
This change fixes a regression introduced by commit 0d05123, which contained a typo that would cause every unrefd interval to fire only once. Fixes: nodejs/node-v0.x-archive#8900 Reviewed-By: Timothy J Fontaine <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-by: Trevor Norris <[email protected]>
- Loading branch information
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* This test is a regression test for joyent/node#8900. | ||
*/ | ||
var assert = require('assert'); | ||
|
||
var N = 5; | ||
var nbIntervalFired = 0; | ||
var timer = setInterval(function() { | ||
++nbIntervalFired; | ||
if (nbIntervalFired === N) | ||
clearInterval(timer); | ||
}, 1); | ||
|
||
timer.unref(); | ||
|
||
setTimeout(function onTimeout() { | ||
assert.strictEqual(nbIntervalFired, N); | ||
}, 100); |