mirror of
https://github.com/actions/checkout.git
synced 2026-05-22 20:11:54 +00:00
Handle checkout 500 retries with backoff
Switch the shared retry helper from randomized delays to exponential backoff so transient GitHub 500 errors are retried predictably. Add coverage for the backoff sequence and regenerate the bundled dist output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
900f2210b1
commit
f2248d03e5
3 changed files with 71 additions and 18 deletions
10
dist/index.js
vendored
10
dist/index.js
vendored
|
|
@ -2567,7 +2567,7 @@ class RetryHelper {
|
|||
core.info(err === null || err === void 0 ? void 0 : err.message);
|
||||
}
|
||||
// Sleep
|
||||
const seconds = this.getSleepAmount();
|
||||
const seconds = this.getSleepAmount(attempt);
|
||||
core.info(`Waiting ${seconds} seconds before trying again`);
|
||||
yield this.sleep(seconds);
|
||||
attempt++;
|
||||
|
|
@ -2576,9 +2576,11 @@ class RetryHelper {
|
|||
return yield action();
|
||||
});
|
||||
}
|
||||
getSleepAmount() {
|
||||
return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) +
|
||||
this.minSeconds);
|
||||
getSleepAmount(attempt) {
|
||||
if (this.minSeconds === 0) {
|
||||
return 0;
|
||||
}
|
||||
return Math.min(this.minSeconds * Math.pow(2, attempt - 1), this.maxSeconds);
|
||||
}
|
||||
sleep(seconds) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue