From a556160874fdb440851999b17daebe6f8031f2f7 Mon Sep 17 00:00:00 2001 From: Helloyunho Date: Sat, 11 Nov 2023 14:18:40 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20fix:=20im=20dumb...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/gateway/mod.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/core/src/gateway/mod.ts b/core/src/gateway/mod.ts index 64d7ee05..02e5c278 100644 --- a/core/src/gateway/mod.ts +++ b/core/src/gateway/mod.ts @@ -200,15 +200,17 @@ export class Gateway extends EventEmitter { break; default: this.emit("CLOSED", e.code, this.retryCount < 5, !this.connectionError); - if (!this.reconnecting && this.retryCount < 5) { - setTimeout(() => { - this.retryCount++; - this.reconnect(!this.connectionError); - }, 500); - } else { - throw new Error( - `Gateway connection closed with code ${e.code}, retry limit reached(${this.retryCount})`, - ); + if (!this.reconnecting) { + if (this.retryCount < 5) { + setTimeout(() => { + this.retryCount++; + this.reconnect(!this.connectionError); + }, 500); + } else { + throw new Error( + `Gateway connection closed with code ${e.code}, retry limit reached(${this.retryCount})`, + ); + } } break; }