only close if open

This commit is contained in:
ITOH
2021-04-15 12:06:12 +02:00
parent e95fcc9305
commit a8cabc6967
+1 -1
View File
@@ -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!");
}
}