Skip to content

Commit

Permalink
🚑️ fix: im dumb...
Browse files Browse the repository at this point in the history
  • Loading branch information
Helloyunho committed Nov 11, 2023
1 parent 815224b commit a556160
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions core/src/gateway/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,17 @@ export class Gateway extends EventEmitter<GatewayEvents> {
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;
}
Expand Down

0 comments on commit a556160

Please sign in to comment.