Skip to content

Commit e930918

Browse files
Move timeout check to end of loop instead of an extra iteration
1 parent cbb8b60 commit e930918

2 files changed

Lines changed: 20 additions & 25 deletions

File tree

lib/entry-points.js

Lines changed: 7 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/upload-lib.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -861,20 +861,10 @@ export async function waitForProcessing(
861861
await util.delay(statusCheckBackoff, { allowProcessExit: false });
862862

863863
for (
864-
let statusCheckingCount = 0;
865-
statusCheckingCount <= STATUS_CHECK_MAX_TRIES; // Aborts on the last loop iteration
866-
statusCheckingCount++
864+
let statusCheckCount = 1;
865+
statusCheckCount <= STATUS_CHECK_MAX_TRIES;
866+
statusCheckCount++
867867
) {
868-
if (statusCheckingCount === STATUS_CHECK_MAX_TRIES) {
869-
// If the analysis hasn't finished processing in the allotted time, we continue anyway rather than failing.
870-
// It's possible the analysis will eventually finish processing, but it's not worth spending more
871-
// Actions time waiting.
872-
logger.warning(
873-
"Timed out waiting for analysis to finish processing. Continuing.",
874-
);
875-
break;
876-
}
877-
878868
let response: OctokitResponse<any> | undefined = undefined;
879869
try {
880870
response = await client.request(
@@ -921,6 +911,16 @@ export async function waitForProcessing(
921911

922912
statusCheckBackoff *= STATUS_CHECK_BACKOFF_MULTIPLIER;
923913
await util.delay(statusCheckBackoff, { allowProcessExit: false });
914+
915+
if (statusCheckCount === STATUS_CHECK_MAX_TRIES) {
916+
// If the analysis hasn't finished processing in the allotted time, we continue anyway rather than failing.
917+
// It's possible the analysis will eventually finish processing, but it's not worth spending more
918+
// Actions time waiting.
919+
logger.warning(
920+
"Timed out waiting for analysis to finish processing. Continuing.",
921+
);
922+
break;
923+
}
924924
}
925925
} finally {
926926
logger.endGroup();

0 commit comments

Comments
 (0)