You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
fix(clustered pubsub): check that client.isOpen
before calling client.disconnect()
when unsubscribing (#2687)
* Confirm the client isOpen before disconnecting * Write tests * fix tests * fix tests --------- Co-authored-by: Leibale Eidelman <me@leibale.com>
This commit is contained in:
@@ -562,7 +562,7 @@ export default class RedisClusterSlots<
|
||||
const client = await this.getPubSubClient();
|
||||
await unsubscribe(client);
|
||||
|
||||
if (!client.isPubSubActive) {
|
||||
if (!client.isPubSubActive && client.isOpen) {
|
||||
await client.disconnect();
|
||||
this.pubSubNode = undefined;
|
||||
}
|
||||
@@ -613,7 +613,7 @@ export default class RedisClusterSlots<
|
||||
const client = await master.pubSubClient;
|
||||
await unsubscribe(client);
|
||||
|
||||
if (!client.isPubSubActive) {
|
||||
if (!client.isPubSubActive && client.isOpen) {
|
||||
await client.disconnect();
|
||||
master.pubSubClient = undefined;
|
||||
}
|
||||
|
Reference in New Issue
Block a user