Move the delay to the end of the loop.

This commit is contained in:
Chris Gavin 2021-11-17 15:51:50 +00:00
parent 4eef7ef32c
commit 215c4f5ff5
No known key found for this signature in database
GPG key ID: 07F950B80C27E4DA
3 changed files with 3 additions and 5 deletions

3
lib/upload-lib.js generated
View file

@ -291,8 +291,6 @@ async function waitForProcessing(repositoryNwo, sarifID, apiDetails, logger) {
logger.warning("Timed out waiting for analysis to finish processing. Continuing.");
break;
}
// We put the delay at the start of the loop, since it's unlikely that the analysis will have succeeded immediately. We might as well wait preemptively.
await util.delay(STATUS_CHECK_FREQUENCY_MILLISECONDS);
try {
const response = await client.request("GET /repos/:owner/:repo/code-scanning/sarifs/:sarif_id", {
owner: repositoryNwo.owner,
@ -322,6 +320,7 @@ async function waitForProcessing(repositoryNwo, sarifID, apiDetails, logger) {
throw e;
}
}
await util.delay(STATUS_CHECK_FREQUENCY_MILLISECONDS);
}
logger.endGroup();
}

File diff suppressed because one or more lines are too long

View file

@ -443,8 +443,6 @@ export async function waitForProcessing(
);
break;
}
// We put the delay at the start of the loop, since it's unlikely that the analysis will have succeeded immediately. We might as well wait preemptively.
await util.delay(STATUS_CHECK_FREQUENCY_MILLISECONDS);
try {
const response = await client.request(
"GET /repos/:owner/:repo/code-scanning/sarifs/:sarif_id",
@ -476,6 +474,7 @@ export async function waitForProcessing(
throw e;
}
}
await util.delay(STATUS_CHECK_FREQUENCY_MILLISECONDS);
}
logger.endGroup();
}