specify time unit variable name retrySleepTimeInMilliSeconds

This commit is contained in:
Abhinav-grd 2021-08-13 09:12:01 +05:30
parent 5fbff89324
commit e08d4d1002

View file

@ -1,6 +1,6 @@
import { sleep } from 'utils/common';
const retrySleepTime = [2000, 5000, 10000];
const retrySleepTimeInMilliSeconds = [2000, 5000, 10000];
export async function retryAsyncFunction(
func: () => Promise<any>,
@ -11,7 +11,7 @@ export async function retryAsyncFunction(
return resp;
} catch (e) {
if (retryCount > 0) {
await sleep(retrySleepTime[3 - retryCount]);
await sleep(retrySleepTimeInMilliSeconds[3 - retryCount]);
await retryAsyncFunction(func, retryCount - 1);
} else {
throw e;