From f2b22c429c0f46c61e1e697e5f2db3af904b4e5c Mon Sep 17 00:00:00 2001 From: branberry Date: Wed, 24 Jan 2024 11:11:45 -0600 Subject: [PATCH] [DOP-4171]: Exit out of task when done --- src/cache-updater/index.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/cache-updater/index.ts b/src/cache-updater/index.ts index fbb15981d..d0f085545 100644 --- a/src/cache-updater/index.ts +++ b/src/cache-updater/index.ts @@ -123,10 +123,17 @@ function getRepos(): RepoInfo[] { } } -const repos = getRepos(); -repos.forEach((repo) => - handler(repo).catch((error) => { - console.error('An error occurred!', error); - }) -); +async function main() { + const repos = getRepos(); + + await Promise.all(repos.map((repo) => + handler(repo).catch((error) => { + console.error('An error occurred!', error); + }) + )); + + process.exit(0); +} + +main(); \ No newline at end of file