diff options
Diffstat (limited to 'deps/npm/node_modules/retry/lib/retry_operation.js')
-rw-r--r-- | deps/npm/node_modules/retry/lib/retry_operation.js | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/deps/npm/node_modules/retry/lib/retry_operation.js b/deps/npm/node_modules/retry/lib/retry_operation.js index 1e564696fe..2b3db8e177 100644 --- a/deps/npm/node_modules/retry/lib/retry_operation.js +++ b/deps/npm/node_modules/retry/lib/retry_operation.js @@ -4,17 +4,14 @@ function RetryOperation(timeouts, options) { options = { forever: options }; } - this._originalTimeouts = JSON.parse(JSON.stringify(timeouts)); this._timeouts = timeouts; this._options = options || {}; - this._maxRetryTime = options && options.maxRetryTime || Infinity; this._fn = null; this._errors = []; this._attempts = 1; this._operationTimeout = null; this._operationTimeoutCb = null; this._timeout = null; - this._operationStart = null; if (this._options.forever) { this._cachedTimeouts = this._timeouts.slice(0); @@ -22,11 +19,6 @@ function RetryOperation(timeouts, options) { } module.exports = RetryOperation; -RetryOperation.prototype.reset = function() { - this._attempts = 1; - this._timeouts = this._originalTimeouts; -} - RetryOperation.prototype.stop = function() { if (this._timeout) { clearTimeout(this._timeout); @@ -44,11 +36,6 @@ RetryOperation.prototype.retry = function(err) { if (!err) { return false; } - var currentTime = new Date().getTime(); - if (err && currentTime - this._operationStart >= this._maxRetryTime) { - this._errors.unshift(new Error('RetryOperation timeout occurred')); - return false; - } this._errors.push(err); @@ -73,7 +60,7 @@ RetryOperation.prototype.retry = function(err) { self._operationTimeoutCb(self._attempts); }, self._operationTimeout); - if (self._options.unref) { + if (this._options.unref) { self._timeout.unref(); } } @@ -107,8 +94,6 @@ RetryOperation.prototype.attempt = function(fn, timeoutOps) { }, self._operationTimeout); } - this._operationStart = new Date().getTime(); - this._fn(this._attempts); }; |