mirror of
https://github.com/redis/go-redis.git
synced 2025-04-19 07:22:17 +03:00
fix nil node dereference when use RouteByLatency in cluster
This commit is contained in:
parent
3fbf7df014
commit
8a5db20d32
@ -564,7 +564,11 @@ func (c *clusterState) slotClosestNode(slot int) (*clusterNode, error) {
|
||||
node = n
|
||||
}
|
||||
}
|
||||
return node, nil
|
||||
if node != nil {
|
||||
return node, nil
|
||||
}
|
||||
// If all nodes are failing - return random node
|
||||
return c.nodes.Random()
|
||||
}
|
||||
|
||||
func (c *clusterState) slotRandomNode(slot int) (*clusterNode, error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user