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 committed by Facebook Github Bot
parent f2340c746b
commit 6b89f0ac28
1 changed files with 5 additions and 1 deletions

View File

@ -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);
}