Skip to content

Commit a7cedfb

Browse files
authoredDec 16, 2020
fixed retry() and forever (#76)
* fixed retry() * fixed forever * Update package.json
1 parent a15d08e commit a7cedfb

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed
 

‎lib/retry_operation.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = RetryOperation;
2525

2626
RetryOperation.prototype.reset = function() {
2727
this._attempts = 1;
28-
this._timeouts = this._originalTimeouts;
28+
this._timeouts = this._originalTimeouts.slice(0);
2929
}
3030

3131
RetryOperation.prototype.stop = function() {
@@ -62,8 +62,7 @@ RetryOperation.prototype.retry = function(err) {
6262
if (this._cachedTimeouts) {
6363
// retry forever, only keep last error
6464
this._errors.splice(0, this._errors.length - 1);
65-
this._timeouts = this._cachedTimeouts.slice(0);
66-
timeout = this._timeouts.shift();
65+
timeout = this._cachedTimeouts.slice(-1);
6766
} else {
6867
return false;
6968
}

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"directories": {
1414
"lib": "./lib"
1515
},
16-
"main": "index",
16+
"main": "index.js",
1717
"engines": {
1818
"node": ">= 4"
1919
},

0 commit comments

Comments
 (0)
Please sign in to comment.