1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-31 05:04:23 +03:00

cluster: don't reload slots if address already changed.

This commit is contained in:
Vladimir Mihailenco
2015-05-05 12:48:49 +03:00
parent b4f481ef43
commit 40bad36dfb
2 changed files with 11 additions and 13 deletions

View File

@ -53,13 +53,7 @@ func (c *ClusterPipeline) Exec() (cmds []Cmder, retErr error) {
cmdsMap := make(map[string][]Cmder)
for _, cmd := range cmds {
slot := hashSlot(cmd.clusterKey())
addrs := c.cluster.slotAddrs(slot)
var addr string
if len(addrs) > 0 {
addr = addrs[0] // First address is master.
}
addr := c.cluster.slotMasterAddr(slot)
cmdsMap[addr] = append(cmdsMap[addr], cmd)
}