From 6d1cecdeee2cd846a848d696bccb1b1edbedd54c Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Thu, 27 May 2021 06:25:43 -0700 Subject: [PATCH] Retry icon download Summary: In public CI (only?), asset downloads sometimes fail with a spurious 404. We already have retrying in place, but it will obviously not do that on a 500. Reviewed By: nikoant Differential Revision: D28744817 fbshipit-source-id: b6a185d8e9db45e02c6427233a0171b00c552751 --- desktop/scripts/build-release.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/desktop/scripts/build-release.ts b/desktop/scripts/build-release.ts index 8b699bad5..f73c070a2 100755 --- a/desktop/scripts/build-release.ts +++ b/desktop/scripts/build-release.ts @@ -317,7 +317,13 @@ function downloadIcons(buildFolder: string) { return Promise.all( iconURLs.map(({name, size, density}) => { const url = getIconURL(name, size, density); - return fetch(url, {}) + return fetch(url, { + retryOptions: { + // Be default, only 5xx are retried but we're getting the odd 404 + // which goes away on a retry for some reason. + retryOnHttpResponse: (res) => res.status >= 400, + }, + }) .then((res) => { if (res.status !== 200) { throw new Error(