packager: GlobalTransformCache: retry keys fetches

Reviewed By: davidaurelio

Differential Revision: D4779641

fbshipit-source-id: 1b156bf075fa2456d9e6b1a3f38855357abc1abb
This commit is contained in:
Jean Lauliac 2017-03-28 10:48:29 -07:00 коммит произвёл Facebook Github Bot
Родитель 1d37dd063c
Коммит 33000c74f9
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -239,13 +239,17 @@ class GlobalTransformCache {
*/
static fetchResultFromURI(uri: string): Promise<CachedResult> {
return GlobalTransformCache._fetchResultFromURI(uri).catch(error => {
if (!(error instanceof FetchError && error.type === 'request-timeout')) {
if (!GlobalTransformCache.isTimeoutError(error)) {
throw error;
}
return this._fetchResultFromURI(uri);
});
}
static isTimeoutError(error: Error): boolean {
return error instanceof FetchError && error.type === 'request-timeout';
}
shouldFetch(props: FetchProps): boolean {
return this._profileSet.has(props.transformOptions);
}