Skip to content

Commit

Permalink
fixed retry() and forever (#76)
Browse files Browse the repository at this point in the history
* fixed retry()

* fixed forever

* Update package.json
  • Loading branch information
wizo06 committed Dec 16, 2020
1 parent a15d08e commit a7cedfb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lib/retry_operation.js
Expand Up @@ -25,7 +25,7 @@ module.exports = RetryOperation;

RetryOperation.prototype.reset = function() {
this._attempts = 1;
this._timeouts = this._originalTimeouts;
this._timeouts = this._originalTimeouts.slice(0);
}

RetryOperation.prototype.stop = function() {
Expand Down Expand Up @@ -62,8 +62,7 @@ RetryOperation.prototype.retry = function(err) {
if (this._cachedTimeouts) {
// retry forever, only keep last error
this._errors.splice(0, this._errors.length - 1);
this._timeouts = this._cachedTimeouts.slice(0);
timeout = this._timeouts.shift();
timeout = this._cachedTimeouts.slice(-1);
} else {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -13,7 +13,7 @@
"directories": {
"lib": "./lib"
},
"main": "index",
"main": "index.js",
"engines": {
"node": ">= 4"
},
Expand Down

0 comments on commit a7cedfb

Please sign in to comment.