fix only reconnecting the first time

This commit is contained in:
Bruno Windels 2020-05-06 20:58:48 +02:00
parent f8f13f54be
commit 2010704f14

View file

@ -34,7 +34,9 @@ export class Reconnector {
} }
async onRequestFailed(hsApi) { async onRequestFailed(hsApi) {
if (!this._isReconnecting) { if (!this._isReconnecting) {
this._isReconnecting = true;
const onlineStatusSubscription = this._onlineStatus && this._onlineStatus.subscribe(online => { const onlineStatusSubscription = this._onlineStatus && this._onlineStatus.subscribe(online => {
if (online) { if (online) {
this.tryNow(); this.tryNow();
@ -52,6 +54,7 @@ export class Reconnector {
// unsubscribe from this._onlineStatus // unsubscribe from this._onlineStatus
onlineStatusSubscription(); onlineStatusSubscription();
} }
this._isReconnecting = false;
} }
} }
} }
@ -75,7 +78,6 @@ export class Reconnector {
} }
async _reconnectLoop(hsApi) { async _reconnectLoop(hsApi) {
this._isReconnecting = true;
this._versionsResponse = null; this._versionsResponse = null;
this._retryDelay.reset(); this._retryDelay.reset();