Skip to content

Commit fa8a93a

Browse files
committed
Confirm the client isOpen before disconnecting
1 parent 5a96058 commit fa8a93a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/client/lib/cluster/cluster-slots.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ export default class RedisClusterSlots<
562562
const client = await this.getPubSubClient();
563563
await unsubscribe(client);
564564

565-
if (!client.isPubSubActive) {
565+
if (!client.isPubSubActive && client.isOpen) {
566566
await client.disconnect();
567567
this.pubSubNode = undefined;
568568
}
@@ -613,7 +613,7 @@ export default class RedisClusterSlots<
613613
const client = await master.pubSubClient;
614614
await unsubscribe(client);
615615

616-
if (!client.isPubSubActive) {
616+
if (!client.isPubSubActive && client.isOpen) {
617617
await client.disconnect();
618618
master.pubSubClient = undefined;
619619
}

0 commit comments

Comments
 (0)