From bb5656d5dc54570f0b8dc42e2e6f245ae24f649c Mon Sep 17 00:00:00 2001 From: NickOvt Date: Mon, 6 Jan 2025 10:54:19 +0200 Subject: [PATCH] fix(retryhandler): ZMS-191-2 (#50) * retry zilter request on errors. Update config * fix keepAliveMaxTimeout default value * refactor, make code cleaner * add methods: POST. Remove 429 status code as to-retry code --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c8d6747..65f56ff 100644 --- a/index.js +++ b/index.js @@ -238,7 +238,9 @@ module.exports.init = async app => { maxRetries: maxRetries || 3, minTimeout: minRetryTimeout || 100, maxTimeout: maxRetryTimeout || 300, - timeoutFactor: timeoutFactor || 1.5 + timeoutFactor: timeoutFactor || 1.5, + statusCodes: [500, 502, 503, 504], + methods: ['POST', 'HEAD', 'OPTIONS', 'CONNECT'] }); const res = await request(zilterUrl, { dispatcher: agent, // use RetryAgent so in case of request fail - retry