Skip to content

Commit

Permalink
fix: prevent extra iterations occurring on getRunIdAndUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
Codex- committed Oct 26, 2024
1 parent 5477224 commit b838ffd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/return-dispatch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ describe("return-dispatch", () => {

const getRunIdAndUrlPromise = getRunIdAndUrl({
...defaultOpts,
workflowTimeoutMs: 10 * 1000,
workflowTimeoutMs: 15 * 1000,
});

// First attempt
Expand Down
2 changes: 1 addition & 1 deletion src/return-dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export async function getRunIdAndUrl({
let elapsedTime = Date.now() - startTime;
while (elapsedTime < workflowTimeoutMs) {
attemptNo++;
elapsedTime = Date.now() - startTime;

// Get all runs for a given workflow ID
const fetchWorkflowRunIds = await api.retryOrTimeout(
Expand Down Expand Up @@ -180,6 +179,7 @@ export async function getRunIdAndUrl({
}

await sleep(constants.WORKFLOW_JOB_STEPS_RETRY_MS);
elapsedTime = Date.now() - startTime;
}

return { success: false, reason: "timeout" };
Expand Down

0 comments on commit b838ffd

Please sign in to comment.