diff --git a/lib/runnable.js b/lib/runnable.js index 98327bf5d9..363b67639f 100644 --- a/lib/runnable.js +++ b/lib/runnable.js @@ -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 () { @@ -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(); + } }; /**