mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(WebSocketShard): don't close in #destroy when status is connecting (#9254)
This commit is contained in:
@@ -224,8 +224,7 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
|
||||
// Prevent a reconnection loop by unbinding the main close event
|
||||
this.connection.removeAllListeners('close');
|
||||
|
||||
const shouldClose =
|
||||
this.connection.readyState === WebSocket.OPEN || this.connection.readyState === WebSocket.CONNECTING;
|
||||
const shouldClose = this.connection.readyState === WebSocket.OPEN;
|
||||
|
||||
this.debug([
|
||||
'Connection status during destroy',
|
||||
@@ -301,7 +300,7 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
|
||||
// If the error is handled, we can just try to reconnect
|
||||
await this.destroy({
|
||||
code: CloseCodes.Normal,
|
||||
reason: 'Something timed out',
|
||||
reason: 'Something timed out or went wrong while waiting for an event',
|
||||
recover: WebSocketShardDestroyRecovery.Reconnect,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user