mirror of
https://github.com/redis/go-redis.git
synced 2025-08-07 12:42:55 +03:00
Use random node when there are no channels
This commit is contained in:
@@ -1537,10 +1537,13 @@ func (c *ClusterClient) pubSub() *PubSub {
|
||||
panic("node != nil")
|
||||
}
|
||||
|
||||
slot := hashtag.Slot(channels[0])
|
||||
|
||||
var err error
|
||||
node, err = c.slotMasterNode(slot)
|
||||
if len(channels) > 0 {
|
||||
slot := hashtag.Slot(channels[0])
|
||||
node, err = c.slotMasterNode(slot)
|
||||
} else {
|
||||
node, err = c.nodes.Random()
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user