add workaround needed in ADW due to REPO-4772 (#1353)

This commit is contained in:
Adina Parpalita
2020-02-25 18:43:32 +02:00
committed by GitHub
parent 1162cb1ba0
commit 2e126b787d
3 changed files with 7 additions and 5 deletions

View File

@@ -75,7 +75,9 @@ export class Utils {
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> {
const pause = duration => new Promise(res => setTimeout(res, duration));
const run = retries => fn().catch(err => (retries > 1 ? pause(delay).then(() => run(retries - 1)) : Promise.reject(err)));
const run = retries => {
return fn().catch(err => (retries > 1 ? pause(delay).then(() => run(retries - 1)) : Promise.reject(err)));
}
return run(retry);
}