Fix indentation and use setTimeout instead of setInterval.
parent
817ee3158e
commit
935e1f5909
|
|
@ -44,23 +44,23 @@ export default class UnavailableModalUiHandler extends ModalUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
tryReconnect(): void {
|
tryReconnect(): void {
|
||||||
updateUserInfo().then(response => {
|
updateUserInfo().then(response => {
|
||||||
if (response[0] || [200, 400].includes(response[1])) {
|
if (response[0] || [200, 400].includes(response[1])) {
|
||||||
clearInterval(this.reconnectTimer);
|
clearInterval(this.reconnectTimer);
|
||||||
this.reconnectTimer = null;
|
this.reconnectTimer = null;
|
||||||
this.reconnectInterval = 5000;
|
this.reconnectInterval = 5000;
|
||||||
this.scene.playSound('pb_bounce_1');
|
this.scene.playSound('pb_bounce_1');
|
||||||
this.reconnectCallback();
|
this.reconnectCallback();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
clearInterval(this.reconnectTimer);
|
clearInterval(this.reconnectTimer);
|
||||||
this.reconnectInterval *= 2;
|
this.reconnectInterval *= 2;
|
||||||
if (this.reconnectInterval >= 60000) {
|
if (this.reconnectInterval > 60000) {
|
||||||
this.reconnectInterval = 60000; // 1 minute maximum delay.
|
this.reconnectInterval = 60000; // 1 minute maximum delay.
|
||||||
}
|
}
|
||||||
this.reconnectTimer = setInterval(this.tryReconnect, this.reconnectInterval);
|
this.reconnectTimer = setTimeout(this.tryReconnect, this.reconnectInterval);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
show(args: any[]): boolean {
|
show(args: any[]): boolean {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue