mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
fix: firstKeyPos cmdSlot (#1502)
* fix(xread):cmdSlot Co-authored-by: zhangxinjian <zhangxinjian@crop.netease.com>
This commit is contained in:
14
command.go
14
command.go
@ -18,6 +18,8 @@ type Cmder interface {
|
||||
Args() []interface{}
|
||||
String() string
|
||||
stringArg(int) string
|
||||
firstKeyPos() int
|
||||
addKeyPos(int)
|
||||
|
||||
readTimeout() *time.Duration
|
||||
readReply(rd *proto.Reader) error
|
||||
@ -73,6 +75,9 @@ func cmdFirstKeyPos(cmd Cmder, info *CommandInfo) int {
|
||||
}
|
||||
}
|
||||
|
||||
if pos := cmd.firstKeyPos(); pos != 0 {
|
||||
return pos
|
||||
}
|
||||
if info == nil {
|
||||
return 0
|
||||
}
|
||||
@ -106,6 +111,7 @@ type baseCmd struct {
|
||||
ctx context.Context
|
||||
args []interface{}
|
||||
err error
|
||||
keyPos int
|
||||
|
||||
_readTimeout *time.Duration
|
||||
}
|
||||
@ -147,6 +153,14 @@ func (cmd *baseCmd) stringArg(pos int) string {
|
||||
return s
|
||||
}
|
||||
|
||||
func (cmd *baseCmd) firstKeyPos() int {
|
||||
return cmd.keyPos
|
||||
}
|
||||
|
||||
func (cmd *baseCmd) addKeyPos(offset int) {
|
||||
cmd.keyPos += offset
|
||||
}
|
||||
|
||||
func (cmd *baseCmd) SetErr(e error) {
|
||||
cmd.err = e
|
||||
}
|
||||
|
Reference in New Issue
Block a user