From dba9cb31f566f15c82162dbde38ed8939d8b8e5a Mon Sep 17 00:00:00 2001 From: Jake Gregg Date: Thu, 31 Jan 2019 15:47:13 -0800 Subject: [PATCH] :recycle: Commands that specify keyslots should not try to hash for keyslot location --- cluster.go | 7 +++++-- command.go | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cluster.go b/cluster.go index 47b79244..a6ca79d6 100644 --- a/cluster.go +++ b/cluster.go @@ -767,8 +767,11 @@ func cmdSlot(cmd Cmder, pos int) int { if pos == 0 { return hashtag.RandomSlot() } - firstKey := cmd.stringArg(pos) - return hashtag.Slot(firstKey) + val, ok := cmd.Args()[pos].(int) + if ok { + return val + } + return hashtag.Slot(cmd.stringArg(pos)) } func (c *ClusterClient) cmdSlot(cmd Cmder) int { diff --git a/command.go b/command.go index cb4f94b1..a70d09ca 100644 --- a/command.go +++ b/command.go @@ -74,6 +74,11 @@ func cmdString(cmd Cmder, val interface{}) string { func cmdFirstKeyPos(cmd Cmder, info *CommandInfo) int { switch cmd.Name() { + case "cluster": + switch cmd.stringArg(1) { + case "getkeysinslot": + return 2 + } case "eval", "evalsha": if cmd.stringArg(2) != "0" { return 3