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
This commit is contained in:
Pascal Hartig
2021-05-27 06:25:43 -07:00
committed by Facebook GitHub Bot
parent 9bfcadc2ef
commit 6d1cecdeee

View File

@@ -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(