3
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2026-06-18 10:56:27 +00:00
This commit is contained in:
Bob Vincent 2026-06-03 15:36:31 +02:00 committed by GitHub
commit fd9f473c29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 71 additions and 18 deletions

10
dist/index.js vendored
View file

@ -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* () {