Use delay instead of wait

Need to also change the signature of delay to allow this to happen.
This commit is contained in:
Andrew Eisenberg
2023-11-15 13:14:19 -08:00
parent df9b50ee5f
commit 4e80a80354
6 changed files with 10 additions and 16 deletions

View File

@@ -9,11 +9,11 @@ import { RepositoryNwo, parseRepositoryNwo } from "./repository";
import * as uploadLib from "./upload-lib";
import {
codeQlVersionAbove,
delay,
getErrorMessage,
getRequiredEnvParam,
isInTestMode,
parseMatrixInput,
wait,
wrapError,
} from "./util";
import {
@@ -222,7 +222,7 @@ async function removeUploadedSarif(
);
// Wait to make sure the analysis is ready for download before requesting it.
await wait(5000);
await delay(5000);
// Get the analysis associated with the uploaded sarif
const analysisInfo = await client.request(

View File

@@ -624,8 +624,9 @@ export async function bundleDb(
*/
export async function delay(
milliseconds: number,
{ allowProcessExit }: { allowProcessExit: boolean },
opts?: { allowProcessExit: boolean },
) {
const { allowProcessExit } = opts || {};
return new Promise((resolve) => {
const timer = setTimeout(resolve, milliseconds);
if (allowProcessExit) {
@@ -913,10 +914,6 @@ export function getErrorMessage(error: unknown): string {
return error instanceof Error ? error.toString() : String(error);
}
export async function wait(ms: number) {
await new Promise((resolve) => setTimeout(resolve, ms));
}
export function prettyPrintPack(pack: Pack) {
return `${pack.name}${pack.version ? `@${pack.version}` : ""}${
pack.path ? `:${pack.path}` : ""