Download icons with retry

Summary:
This quite often fails in CI. Adobe's fetch has some very sensible defaults
and will do exponential backoff and retry for up to a minute.
That should hopefully fix issues where we have to restart the whole build
just to fix one measly icon download.

Reviewed By: jknoxville

Differential Revision: D24649807

fbshipit-source-id: efbc9eb29e4b5a0f74b0b6ad6dea4aaf86391363
This commit is contained in:
Pascal Hartig
2020-11-05 05:14:58 -08:00
committed by Facebook GitHub Bot
parent d28610a9d2
commit 3a839bddae
3 changed files with 34 additions and 3 deletions

View File

@@ -20,7 +20,7 @@ import {
genMercurialRevision,
generatePluginEntryPoints,
} from './build-utils';
import fetch from 'node-fetch';
import fetch from '@adobe/node-fetch-retry';
import {getIcons, buildLocalIconPath, getIconURL} from '../app/src/utils/icons';
import isFB from './isFB';
import copyPackageWithDependencies from './copy-package-with-dependencies';
@@ -163,7 +163,7 @@ function downloadIcons(buildFolder: string) {
return Promise.all(
iconURLs.map(({name, size, density}) => {
const url = getIconURL(name, size, density);
return fetch(url)
return fetch(url, {})
.then((res) => {
if (res.status !== 200) {
throw new Error(