Skip to content

Commit

Permalink
Add configurable maxRetries (aws-actions#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloud303-cholden committed Jul 22, 2023
1 parent 385d7e1 commit c719512
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ let defaultSleep = function (ms) {
let sleep = defaultSleep;

// retryAndBackoff retries with exponential backoff the promise if the error isRetryable upto maxRetries time.
const retryAndBackoff = async (fn, isRetryable, retries = 0, maxRetries = 12, base = 50) => {
const retryAndBackoff = async (fn, isRetryable, maxRetries, retries = 0, base = 50) => {
try {
return await fn();
} catch (err) {
Expand Down Expand Up @@ -321,6 +321,7 @@ async function run() {
const proxyServer = core.getInput('http-proxy', { required: false });
const inlineSessionPolicy = core.getInput('inline-session-policy', { required: false });
const managedSessionPolicies = core.getMultilineInput('managed-session-policies', { required: false })
const maxRetries = core.getInput('max-retries', { required: false }) || 12;

if (!region.match(REGION_REGEX)) {
throw new Error(`Region is not valid: ${region}`);
Expand Down Expand Up @@ -390,7 +391,7 @@ async function run() {
webIdentityToken,
inlineSessionPolicy,
managedSessionPolicies
}) }, true);
}) }, true, maxRetries);
exportCredentials(roleCredentials);
// We need to validate the credentials in 2 of our use-cases
// First: self-hosted runners. If the GITHUB_ACTIONS environment variable
Expand Down

0 comments on commit c719512

Please sign in to comment.