Skip to content

Commit

Permalink
fix(installer): retry installer when hitting ETIMEDOUT as well (#5239)
Browse files Browse the repository at this point in the history
Fixes #5233
  • Loading branch information
aslushnikov committed Feb 1, 2021
1 parent 7b53631 commit 08e2b5b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/install/browserFetcher.ts
Expand Up @@ -137,7 +137,8 @@ export async function downloadBrowserWithProgressBar(browsersPath: string, brows
const {error} = await downloadFile(url, zipPath, progress);
if (!error)
break;
if (attempt < N && error && typeof error === 'object' && typeof error.message === 'string' && error.message.includes('ECONNRESET')) {
const errorMessage = typeof error === 'object' && typeof error.message === 'string' ? error.message : '';
if (attempt < N && (errorMessage.includes('ECONNRESET') || errorMessage.includes('ETIMEDOUT'))) {
// Maximum delay is 3rd retry: 1337.5ms
const millis = (Math.random() * 200) + (250 * Math.pow(1.5, attempt));
await new Promise(c => setTimeout(c, millis));
Expand Down

0 comments on commit 08e2b5b

Please sign in to comment.