mirror of
https://code.forgejo.org/actions/checkout.git
synced 2026-06-18 10:56:27 +00:00
Merge f2248d03e5 into df4cb1c069
This commit is contained in:
commit
fd9f473c29
3 changed files with 71 additions and 18 deletions
10
dist/index.js
vendored
10
dist/index.js
vendored
|
|
@ -2616,7 +2616,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++;
|
||||
|
|
@ -2625,9 +2625,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