-
-
Notifications
You must be signed in to change notification settings - Fork 19
feat: New input parameter for the action and linear backoff strategy for retries #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9c8b77c
87b877d
1674d6a
ae20375
7d72531
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| /* eslint-disable @typescript-eslint/no-inferrable-types */ | ||
|
|
||
| export const WORKFLOW_FETCH_TIMEOUT_MS: number = 60 * 1000; | ||
| export const WORKFLOW_JOB_STEPS_RETRY_MS: number = 5000; | ||
| export const WORKFLOW_JOB_STEPS_SERVER_ERROR_RETRY_MAX: number = 3; | ||
| export const WORKFLOW_JOB_STEPS_SERVER_ERROR_RETRY_MS: number = 500; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,13 +129,15 @@ export interface GetRunIdAndUrlOpts { | |
| distinctIdRegex: RegExp; | ||
| workflowId: number; | ||
| workflowTimeoutMs: number; | ||
| workflowJobStepsRetryMs: number; | ||
| } | ||
| export async function getRunIdAndUrl({ | ||
| startTime, | ||
| branch, | ||
| distinctIdRegex, | ||
| workflowId, | ||
| workflowTimeoutMs, | ||
| workflowJobStepsRetryMs, | ||
| }: GetRunIdAndUrlOpts): Promise<Result<{ id: number; url: string }>> { | ||
| const retryTimeout = Math.max( | ||
| constants.WORKFLOW_FETCH_TIMEOUT_MS, | ||
|
|
@@ -178,7 +180,14 @@ export async function getRunIdAndUrl({ | |
| core.info(`No Run IDs found for workflow, attempt ${attemptNo}...`); | ||
| } | ||
|
|
||
| await sleep(constants.WORKFLOW_JOB_STEPS_RETRY_MS); | ||
| const waitTime = Math.min( | ||
| workflowJobStepsRetryMs * attemptNo, // Lineal backoff | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lineal backoff makes sense to me, but does change the behaviour people expect when setting If you, as a user, specify You may expect this to behave such that:
But implicitly using lineal backoff with the attempt count as the magnitude
Perhaps for now just noting this behaviour in the readme will be enough:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed in the readme and in the action description too |
||
| workflowTimeoutMs - elapsedTime, // Ensure we don't exceed the timeout | ||
| ); | ||
|
|
||
| core.info(`Waiting for ${waitTime}ms before the next attempt...`); | ||
| await sleep(waitTime); | ||
|
|
||
| elapsedTime = Date.now() - startTime; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.