From 7c714dd49fe9f52c3d84de58e3397d4541298661 Mon Sep 17 00:00:00 2001 From: imsk17 Date: Thu, 12 Sep 2024 23:17:11 +0530 Subject: [PATCH] feat(retry): remove retry limit --- src/handler/index.ts | 2 -- src/handler/utils.ts | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/handler/index.ts b/src/handler/index.ts index 2afb21e..8cb4015 100644 --- a/src/handler/index.ts +++ b/src/handler/index.ts @@ -172,7 +172,6 @@ export async function listenEvents( approvalFn, `Approving transfer ${JSON.stringify(inft, null, 2)}`, log, - 3, ); log.info( @@ -268,7 +267,6 @@ export async function listenStakeEvents( approvalFn, `Approving stake ${JSON.stringify(ev, null, 2)}`, log, - 6, ); log.info( approved diff --git a/src/handler/utils.ts b/src/handler/utils.ts index cd98c88..8467288 100644 --- a/src/handler/utils.ts +++ b/src/handler/utils.ts @@ -45,17 +45,13 @@ export async function retry( func: () => Promise, ctx: string, log: LogInstance, - retries = 3, ): Promise { try { return await func(); } catch (err) { - if (retries === 0) { - throw err; - } - log.info(`Context: ${ctx} - Retrying ${retries} more times. Error: ${err}`); - await setTimeout(6000 * (3 - retries)); - return retry(func, ctx, log, retries - 1); + log.info(`Context: ${ctx} - Retrying. Error:`, err); + await setTimeout(5000); + return retry(func, ctx, log); } }