From 47a9efdbb9c987c8ab06c5931849ef82dfdfcf86 Mon Sep 17 00:00:00 2001 From: Ayush Jha Date: Wed, 7 Feb 2024 14:15:17 +0545 Subject: [PATCH] Add retry when fetching the shell script this makes it so fetching the URL is retried 10 times max when it fails for any reason. --- src/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index d656057..9142036 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,8 +41,13 @@ const main = async () => //Log info(`Downloaded ${transferred}K out of ${total}K (${percent}%)`); }; + const url = isWindows ? 'https://win.wasmer.io' : 'https://get.wasmer.io'; await pipeline( - got.stream(isWindows ? 'https://win.wasmer.io' : 'https://get.wasmer.io').on('downloadProgress', progressHandler), + got.stream(url, { + retry: { + limit: 10, + } + }).on('downloadProgress', progressHandler), createWriteStream(tmp, { mode: 0o655 }) @@ -92,4 +97,4 @@ const main = async () => main().catch(error => { throw error; -}); \ No newline at end of file +});