Skip to content

Commit

Permalink
Speed up auth in case token expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
ZIMkaRU committed Apr 10, 2024
1 parent e8b819d commit ee41a11
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions workers/loc.api/helpers/get-data-from-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const {
isRateLimitError,
isNonceSmallError,
isUserIsNotMerchantError,
isENetError
isENetError,
isAuthError
} = require('./api-errors-testers')

const _delay = (mc = 80000, interrupter) => {
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit ee41a11

Please sign in to comment.