Skip to content

Commit c245a19

Browse files
rmgjasnell
authored andcommitted
lib: fix undefined timeout regression
63644dd introduced a regression caused by everyone's favourite JavaScript feature: undefined < 0 === undefined >= 0. Add a case to the existing tests to cover this scenario and then add the check for undefined that makes the test pass. PR-URL: #3331 Reviewed-By: Fedor Indutny <[email protected]> Reviewed By: Evan Lucas <[email protected]>
1 parent b3cbd13 commit c245a19

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/timers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var lists = {};
3030
// with them.
3131
exports.active = function(item) {
3232
const msecs = item._idleTimeout;
33-
if (msecs < 0) return;
33+
if (msecs < 0 || msecs === undefined) return;
3434

3535
item._idleStart = Timer.now();
3636

test/parallel/test-timers-active.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ legitTimers.forEach(function(legit) {
2222

2323
// active() should not create a timer for these
2424
var bogusTimers = [
25-
{ _idleTimeout: -1 }
25+
{ _idleTimeout: -1 },
26+
{ _idleTimeout: undefined },
2627
];
2728

2829
bogusTimers.forEach(function(bogus) {

0 commit comments

Comments
 (0)