diff --git a/rediscluster/mapping.go b/rediscluster/mapping.go index 36d5cf5..c696985 100644 --- a/rediscluster/mapping.go +++ b/rediscluster/mapping.go @@ -3,6 +3,7 @@ package rediscluster import ( "crypto/tls" "fmt" + "math/bits" "sync/atomic" "unsafe" @@ -278,33 +279,39 @@ func (c *Cluster) connForPolicySlaves(policy ReplicaPolicyEnum, seen []*rediscon weights := c.weightsForPolicySlaves(policy, shard) health := atomic.LoadUint32(&shard.good) // load health information - healthWeight := c.getHealthWeight(weights, health) + all := uint32(1)< 0 { + r = nextRng(off, total) + } for i, w := range weights { - if health&(1<