From a8cabc6967c155e5b1817bf351336ad7e512393e Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Thu, 15 Apr 2021 12:06:12 +0200 Subject: [PATCH] only close if open --- src/ws/tell_cluster_to_identify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ws/tell_cluster_to_identify.ts b/src/ws/tell_cluster_to_identify.ts index 5f3b86fab..99a5951eb 100644 --- a/src/ws/tell_cluster_to_identify.ts +++ b/src/ws/tell_cluster_to_identify.ts @@ -10,7 +10,7 @@ export async function tellClusterToIdentify( const oldShard = ws.shards.get(shardId); await ws.identify(shardId, ws.maxShards); - if (oldShard) { + if (oldShard?.ws.readyState === WebSocket.OPEN) { oldShard.ws.close(3065, "Resharded!"); } }