mirror of https://github.com/go-redis/redis.git
Merge pull request #959 from greggjs/cluster-command-keyslots
Cluster commands respecting keyslots from command input
This commit is contained in:
commit
228e43ba24
|
@ -772,6 +772,11 @@ func cmdSlot(cmd Cmder, pos int) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ClusterClient) cmdSlot(cmd Cmder) int {
|
func (c *ClusterClient) cmdSlot(cmd Cmder) int {
|
||||||
|
args := cmd.Args()
|
||||||
|
if args[0] == "cluster" && args[1] == "getkeysinslot" {
|
||||||
|
return args[2].(int)
|
||||||
|
}
|
||||||
|
|
||||||
cmdInfo := c.cmdInfo(cmd.Name())
|
cmdInfo := c.cmdInfo(cmd.Name())
|
||||||
return cmdSlot(cmd, cmdFirstKeyPos(cmd, cmdInfo))
|
return cmdSlot(cmd, cmdFirstKeyPos(cmd, cmdInfo))
|
||||||
}
|
}
|
||||||
|
@ -783,7 +788,7 @@ func (c *ClusterClient) cmdSlotAndNode(cmd Cmder) (int, *clusterNode, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdInfo := c.cmdInfo(cmd.Name())
|
cmdInfo := c.cmdInfo(cmd.Name())
|
||||||
slot := cmdSlot(cmd, cmdFirstKeyPos(cmd, cmdInfo))
|
slot := c.cmdSlot(cmd)
|
||||||
|
|
||||||
if c.opt.ReadOnly && cmdInfo != nil && cmdInfo.ReadOnly {
|
if c.opt.ReadOnly && cmdInfo != nil && cmdInfo.ReadOnly {
|
||||||
if c.opt.RouteByLatency {
|
if c.opt.RouteByLatency {
|
||||||
|
|
Loading…
Reference in New Issue