Skip to content

Commit

Permalink
Add retry when fetching the shell script
Browse files Browse the repository at this point in the history
this makes it so fetching the URL is retried 10 times max when it fails for any
reason.
  • Loading branch information
ayys committed Feb 7, 2024
1 parent ba7631c commit 47a9efd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down Expand Up @@ -92,4 +97,4 @@ const main = async () =>
main().catch(error =>
{
throw error;
});
});

0 comments on commit 47a9efd

Please sign in to comment.