From fdbf6c9839113cd244a0e02b9c8a4039b40d1369 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Thu, 14 Apr 2022 22:04:41 +0300 Subject: [PATCH] frontend: fix reconnect timeout --- frontend/src/gateway.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/gateway.js b/frontend/src/gateway.js index cf177d1..9a1929c 100644 --- a/frontend/src/gateway.js +++ b/frontend/src/gateway.js @@ -33,7 +33,6 @@ export default { if (this.reconnectTimeout) { clearTimeout(this.reconnectTimeout); } - this.reconnectDelay = 400; }; this.ws.onmessage = (event) => { const payload = JSON.parse(event.data); @@ -56,12 +55,16 @@ export default { case GatewayPayloadType.Ready: { this.user = payload.d.user; this.channels = payload.d.channels; + + this.reconnectDelay = 400; break; } } }; this.ws.onclose = () => { - this.reconnectDelay *= 2; + if (this.reconnectDelay < 60000) { + this.reconnectDelay *= 2; + } this.authenticated = false; this.user = null; this.channels = null;