forked from mystiq/hydrogen-web
fix only reconnecting the first time
This commit is contained in:
parent
f8f13f54be
commit
2010704f14
1 changed files with 4 additions and 2 deletions
|
@ -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();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue