fix: maxRetry hit infinite loop with negative input

This commit is contained in:
peterwoodworth committed 2023-08-11 16:24:09 -07:00
1 parent 65c2143642
commit 7f4507af3c
5 files changed
+30 -5

No files matched your search

+1 -1
View File
@@ -124,7 +124,7 @@ export async function retryAndBackoff<T>(
// It's retryable, so sleep and retry.
await sleep(Math.random() * (Math.pow(2, retries) * base));
retries += 1;
if (retries === maxRetries) {
if (retries >= maxRetries) {
throw err;
}
return await retryAndBackoff(fn, isRetryable, maxRetries, retries, base);
+4 -1
View File
@@ -44,7 +44,10 @@ export async function run() {
const unsetCurrentCredentials = unsetCurrentCredentialsInput.toLowerCase() === 'true';
const disableRetryInput = core.getInput('disable-retry', { required: false }) || 'false';
const disableRetry = disableRetryInput.toLowerCase() === 'true';
const maxRetries = parseInt(core.getInput('retry-max-attempts', { required: false })) || 12;
let maxRetries = parseInt(core.getInput('retry-max-attempts', { required: false })) || 12;
if (maxRetries < 1) {
maxRetries = 1;
}
for (const managedSessionPolicy of managedSessionPoliciesInput) {
managedSessionPolicies.push({ arn: managedSessionPolicy });
}