mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +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
|
// Prevent a reconnection loop by unbinding the main close event
|
||||||
this.connection.removeAllListeners('close');
|
this.connection.removeAllListeners('close');
|
||||||
|
|
||||||
const shouldClose =
|
const shouldClose = this.connection.readyState === WebSocket.OPEN;
|
||||||
this.connection.readyState === WebSocket.OPEN || this.connection.readyState === WebSocket.CONNECTING;
|
|
||||||
|
|
||||||
this.debug([
|
this.debug([
|
||||||
'Connection status during destroy',
|
'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
|
// If the error is handled, we can just try to reconnect
|
||||||
await this.destroy({
|
await this.destroy({
|
||||||
code: CloseCodes.Normal,
|
code: CloseCodes.Normal,
|
||||||
reason: 'Something timed out',
|
reason: 'Something timed out or went wrong while waiting for an event',
|
||||||
recover: WebSocketShardDestroyRecovery.Reconnect,
|
recover: WebSocketShardDestroyRecovery.Reconnect,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user