-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c253e96
commit f7b92ad
Showing
32 changed files
with
1,674 additions
and
199 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RetryPolicy = void 0; | ||
var RetryPolicy = /** @class */ (function () { | ||
function RetryPolicy() { | ||
} | ||
RetryPolicy.LinearRetryPolicy = function (configuration) { | ||
return { | ||
delay: configuration.delay, | ||
maximumRetry: configuration.maximumRetry, | ||
shouldRetry: function (error, attempt) { | ||
var _a; | ||
if (((_a = error === null || error === void 0 ? void 0 : error.status) === null || _a === void 0 ? void 0 : _a.statusCode) === 403) { | ||
return false; | ||
} | ||
return this.maximumRetry > attempt; | ||
}, | ||
getDelay: function (_) { | ||
return this.delay * 1000; | ||
}, | ||
}; | ||
}; | ||
RetryPolicy.ExponentialRetryPolicy = function (configuration) { | ||
return { | ||
minimumDelay: configuration.minimumDelay, | ||
maximumDelay: configuration.maximumDelay, | ||
maximumRetry: configuration.maximumRetry, | ||
shouldRetry: function (error, attempt) { | ||
var _a; | ||
if (((_a = error === null || error === void 0 ? void 0 : error.status) === null || _a === void 0 ? void 0 : _a.statusCode) === 403) { | ||
return false; | ||
} | ||
return this.maximumRetry > attempt; | ||
}, | ||
getDelay: function (attempt) { | ||
var calculatedDelay = Math.trunc(Math.pow(2, attempt)) * 1000 + Math.random() * 1000; | ||
if (calculatedDelay > 150000) { | ||
return 150000; | ||
} | ||
else { | ||
return calculatedDelay; | ||
} | ||
}, | ||
}; | ||
}; | ||
return RetryPolicy; | ||
}()); | ||
exports.RetryPolicy = RetryPolicy; |
Oops, something went wrong.