Fix indentation and use setTimeout instead of setInterval.

pull/628/head
Jesse Selover 2024-05-08 04:06:28 -07:00
parent 817ee3158e
commit 935e1f5909
1 changed files with 17 additions and 17 deletions

View File

@ -44,23 +44,23 @@ export default class UnavailableModalUiHandler extends ModalUiHandler {
}
tryReconnect(): void {
updateUserInfo().then(response => {
if (response[0] || [200, 400].includes(response[1])) {
clearInterval(this.reconnectTimer);
this.reconnectTimer = null;
this.reconnectInterval = 5000;
this.scene.playSound('pb_bounce_1');
this.reconnectCallback();
}
else {
clearInterval(this.reconnectTimer);
this.reconnectInterval *= 2;
if (this.reconnectInterval >= 60000) {
this.reconnectInterval = 60000; // 1 minute maximum delay.
}
this.reconnectTimer = setInterval(this.tryReconnect, this.reconnectInterval);
}
});
updateUserInfo().then(response => {
if (response[0] || [200, 400].includes(response[1])) {
clearInterval(this.reconnectTimer);
this.reconnectTimer = null;
this.reconnectInterval = 5000;
this.scene.playSound('pb_bounce_1');
this.reconnectCallback();
}
else {
clearInterval(this.reconnectTimer);
this.reconnectInterval *= 2;
if (this.reconnectInterval > 60000) {
this.reconnectInterval = 60000; // 1 minute maximum delay.
}
this.reconnectTimer = setTimeout(this.tryReconnect, this.reconnectInterval);
}
});
}
show(args: any[]): boolean {