Skip to content

Commit

Permalink
fix: unref timers implicitly scheduled for MAX_TIMEOUT
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Feb 28, 2024
1 parent 1498a57 commit d4a65aa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/runnable.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Runnable.prototype.clearTimeout = function () {
*/
Runnable.prototype.resetTimeout = function () {
var self = this;
var ms = this.timeout() || MAX_TIMEOUT;
var ms = this.timeout();

this.clearTimeout();
this.timer = setTimeout(function () {
Expand All @@ -243,7 +243,11 @@ Runnable.prototype.resetTimeout = function () {
}
self.callback(self._timeoutError(ms));
self.timedOut = true;
}, ms);
}, ms || MAX_TIMEOUT);

if (!ms) {
this.timer.unref();
}
};

/**
Expand Down

0 comments on commit d4a65aa

Please sign in to comment.