From 08e2b5b825852bc4a688f1bd192c37eb227932f5 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Mon, 1 Feb 2021 09:30:22 -0800 Subject: [PATCH] fix(installer): retry installer when hitting ETIMEDOUT as well (#5239) Fixes #5233 --- src/install/browserFetcher.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/install/browserFetcher.ts b/src/install/browserFetcher.ts index f920b92067..7a097d3c28 100644 --- a/src/install/browserFetcher.ts +++ b/src/install/browserFetcher.ts @@ -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));