mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
fix(installer): retry installer when hitting ETIMEDOUT as well (#5239)
Fixes #5233
This commit is contained in:
parent
7b5363198b
commit
08e2b5b825
@ -137,7 +137,8 @@ export async function downloadBrowserWithProgressBar(browsersPath: string, brows
|
|||||||
const {error} = await downloadFile(url, zipPath, progress);
|
const {error} = await downloadFile(url, zipPath, progress);
|
||||||
if (!error)
|
if (!error)
|
||||||
break;
|
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
|
// Maximum delay is 3rd retry: 1337.5ms
|
||||||
const millis = (Math.random() * 200) + (250 * Math.pow(1.5, attempt));
|
const millis = (Math.random() * 200) + (250 * Math.pow(1.5, attempt));
|
||||||
await new Promise(c => setTimeout(c, millis));
|
await new Promise(c => setTimeout(c, millis));
|
||||||
|
Loading…
Reference in New Issue
Block a user