From c704863f544c5aea960c4291dab9bdabf26adad5 Mon Sep 17 00:00:00 2001 From: murtaza98 Date: Thu, 7 Oct 2021 11:48:30 +0530 Subject: [PATCH] Fix Omni-webhooks retry mechanism going in infinite loop --- app/livechat/server/lib/Livechat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/livechat/server/lib/Livechat.js b/app/livechat/server/lib/Livechat.js index 027e163d6bb5..08d8151f2509 100644 --- a/app/livechat/server/lib/Livechat.js +++ b/app/livechat/server/lib/Livechat.js @@ -734,9 +734,9 @@ export const Livechat = { } catch (e) { Livechat.webhookLogger.error(`Response error on ${ 11 - attempts } try ->`, e); // try 10 times after 10 seconds each - Livechat.webhookLogger.warn('Will try again in 10 seconds ...'); + (attempts - 1) && Livechat.webhookLogger.warn('Will try again in 10 seconds ...'); setTimeout(Meteor.bindEnvironment(function() { - Livechat.sendRequest(postData, callback, attempts--); + Livechat.sendRequest(postData, callback, attempts - 1); }), 10000); } },