From 212b4232dec3ab46fa2e390acb55916bc7151869 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 20 Feb 2024 12:32:19 +0200 Subject: [PATCH] Stop auth token refresh interval if auth error --- workers/loc.api/sync/authenticator/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/workers/loc.api/sync/authenticator/index.js b/workers/loc.api/sync/authenticator/index.js index dbe81c3fe..79f98a06d 100644 --- a/workers/loc.api/sync/authenticator/index.js +++ b/workers/loc.api/sync/authenticator/index.js @@ -7,7 +7,8 @@ const { ArgsParamsError } = require('bfx-report/workers/loc.api/errors') const { - isENetError + isENetError, + isAuthError } = require('bfx-report/workers/loc.api/helpers') const { serializeVal } = require('../dao/helpers') @@ -1385,6 +1386,10 @@ class Authenticator { authToken: prevAuthToken }) } catch (err) { + if (isAuthError(err)) { + clearInterval(newAuthTokenRefreshInterval) + } + this.logger.debug(err) await this.wsEventEmitterFactory()