Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
rmg committed Oct 12, 2015
commit 1e14233de10a6d1e2c2ea17609f2ff4161ee9bc5
2 changes: 1 addition & 1 deletion lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var lists = {};
// with them.
exports.active = function(item) {
const msecs = item._idleTimeout;
if (msecs < 0) return;
if (msecs < 0 || msecs === undefined) return;

item._idleStart = Timer.now();

Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-timers-active.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ legitTimers.forEach(function(legit) {

// active() should not create a timer for these
var bogusTimers = [
{ _idleTimeout: -1 }
{ _idleTimeout: -1 },
{ _idleTimeout: undefined }
];

bogusTimers.forEach(function(bogus) {
Expand Down