Skip to content

Commit

Permalink
Merge pull request redis#959 from greggjs/cluster-command-keyslots
Browse files Browse the repository at this point in the history
Cluster commands respecting keyslots from command input
  • Loading branch information
vmihailenco authored Feb 3, 2019
2 parents 46a69ac + 67dcdea commit 228e43b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,11 @@ func cmdSlot(cmd Cmder, pos int) 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())
return cmdSlot(cmd, cmdFirstKeyPos(cmd, cmdInfo))
}
Expand All @@ -783,7 +788,7 @@ func (c *ClusterClient) cmdSlotAndNode(cmd Cmder) (int, *clusterNode, error) {
}

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.RouteByLatency {
Expand Down

0 comments on commit 228e43b

Please sign in to comment.