From ee41a1197dabd0e9cfe6a19f046163430cffcb3b Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 10 Apr 2024 14:36:34 +0300 Subject: [PATCH] Speed up auth in case token expiration --- workers/loc.api/helpers/get-data-from-api.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/workers/loc.api/helpers/get-data-from-api.js b/workers/loc.api/helpers/get-data-from-api.js index 2db98412..86e83b7f 100644 --- a/workers/loc.api/helpers/get-data-from-api.js +++ b/workers/loc.api/helpers/get-data-from-api.js @@ -8,7 +8,8 @@ const { isRateLimitError, isNonceSmallError, isUserIsNotMerchantError, - isENetError + isENetError, + isAuthError } = require('./api-errors-testers') const _delay = (mc = 80000, interrupter) => { @@ -161,7 +162,10 @@ module.exports = ( // Handle unexpected BFX API errors countUnexpectedError += 1 - if (countUnexpectedError > 3) { + if ( + countUnexpectedError > 3 || + isAuthError(err) + ) { throw err } if (_isInterrupted(_interrupter)) {