From 3a38e3badec8a2addd5d7562f5a29f71741fa950 Mon Sep 17 00:00:00 2001 From: Alexis Date: Wed, 15 Sep 2021 18:14:17 +0930 Subject: [PATCH] fix: add allowRetry for relay socket --- app/mothership/index.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/mothership/index.ts b/app/mothership/index.ts index 28e11720f..e74335305 100644 --- a/app/mothership/index.ts +++ b/app/mothership/index.ts @@ -150,6 +150,7 @@ export const startRelay = () => { sockets.relay.on('unexpected-response', (code: number, message: string) => { log.debug('☁️ RELAY:UNEXPECTED_RESPONSE:%s %s', code, message); + const allowRetry = !isRelayConnecting; switch (code) { case 401: @@ -188,7 +189,8 @@ export const startRelay = () => { // Retry in 30s setTimeout(() => { // Another process has already kicked this off - if (isRelayConnecting) { + if (!allowRetry) { + log.debug('☁️ RELAY:ALLOW_RETRY:false'); return; } @@ -206,7 +208,8 @@ export const startRelay = () => { // Retry in 60s setTimeout(() => { // Another process has already kicked this off - if (isRelayConnecting) { + if (!allowRetry) { + log.debug('☁️ RELAY:ALLOW_RETRY:false'); return; } @@ -224,7 +227,8 @@ export const startRelay = () => { // Retry in 60s setTimeout(() => { // Another process has already kicked this off - if (isRelayConnecting) { + if (!allowRetry) { + log.debug('☁️ RELAY:ALLOW_RETRY:false'); return; } @@ -238,7 +242,8 @@ export const startRelay = () => { default: // Another process has already kicked this off - if (isRelayConnecting) { + if (!allowRetry) { + log.debug('☁️ RELAY:ALLOW_RETRY:false'); return; }