mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
Fixes #1386; pipeline.Exec() sometimes returns spurious StatusCmd
This is caused by function `wrapMultiExec` sometimes clobbering the caller's cmd slice, corrupting future requests.
This commit is contained in:
10
redis.go
10
redis.go
@ -492,11 +492,11 @@ func wrapMultiExec(ctx context.Context, cmds []Cmder) []Cmder {
|
||||
if len(cmds) == 0 {
|
||||
panic("not reached")
|
||||
}
|
||||
cmds = append(cmds, make([]Cmder, 2)...)
|
||||
copy(cmds[1:], cmds[:len(cmds)-2])
|
||||
cmds[0] = NewStatusCmd(ctx, "multi")
|
||||
cmds[len(cmds)-1] = NewSliceCmd(ctx, "exec")
|
||||
return cmds
|
||||
cmdCopy := make([]Cmder, len(cmds)+2)
|
||||
cmdCopy[0] = NewStatusCmd(ctx, "multi")
|
||||
copy(cmdCopy[1:], cmds)
|
||||
cmdCopy[len(cmdCopy)-1] = NewSliceCmd(ctx, "exec")
|
||||
return cmdCopy
|
||||
}
|
||||
|
||||
func txPipelineReadQueued(rd *proto.Reader, statusCmd *StatusCmd, cmds []Cmder) error {
|
||||
|
Reference in New Issue
Block a user