Skip to content

Commit ae20375

Browse files
committed
solve comments
1 parent 1674d6a commit ae20375

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ steps:
2525
workflow: automation-test.yml
2626
workflow_inputs: '{ "some_input": "value" }' # Optional
2727
workflow_timeout_seconds: 120 # Default: 300
28+
# Lineal backoff retry attempts are made where the attempt count is
29+
# the magnitude and the scaling value is `workflow_job_steps_retry_seconds`
2830
workflow_job_steps_retry_seconds: 10 # Default: 5
2931
distinct_id: someDistinctId # Optional
3032

action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ inputs:
3131
description: Time until giving up waiting for the start of the workflow run.
3232
default: 300
3333
workflow_job_steps_retry_seconds:
34-
description: Duration to wait between retries while monitoring for the workflow run to start.
34+
description: |
35+
The interval (in seconds) to wait between retries, each retry uses a linear backoff strategy.
36+
Where the wait time increases by this value with each attempt (e.g., 1st retry = this value, 2nd retry = 2x this value, etc.).
3537
default: 5
3638
distinct_id:
3739
description: Specify a static string to use instead of a random distinct ID.

src/return-dispatch.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,11 @@ describe("return-dispatch", () => {
837837
expect(coreDebugLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
838838

839839
expect(utilSleepMock).toHaveBeenCalledTimes(3);
840-
expect(utilSleepMock.mock.calls[2]?.[0]).toBeLessThanOrEqual(retryMs * 3);
840+
const elapsedTime = Date.now() - defaultOpts.startTime; // `waitTime` should be using `workflowTimeoutMs` at this point
841+
expect(utilSleepMock.mock.lastCall?.[0]).approximately(
842+
timeoutMs - elapsedTime,
843+
5,
844+
);
841845

842846
resetLogMocks();
843847
await vi.advanceTimersByTimeAsync(retryMs * 3);

src/return-dispatch.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ export async function getRunIdAndUrl({
146146

147147
let attemptNo = 0;
148148
let elapsedTime = Date.now() - startTime;
149-
150149
while (elapsedTime < workflowTimeoutMs) {
151150
attemptNo++;
152151

0 commit comments

Comments
 (0)