mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
fix(txpipeline): short curcuit the tx if there are no commands
This commit is contained in:
@ -1497,6 +1497,10 @@ func (c *ClusterClient) processTxPipeline(ctx context.Context, cmds []Cmder) err
|
|||||||
// Trim multi .. exec.
|
// Trim multi .. exec.
|
||||||
cmds = cmds[1 : len(cmds)-1]
|
cmds = cmds[1 : len(cmds)-1]
|
||||||
|
|
||||||
|
if len(cmds) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
state, err := c.state.Get(ctx)
|
state, err := c.state.Get(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
setCmdsErr(cmds, err)
|
setCmdsErr(cmds, err)
|
||||||
@ -1509,9 +1513,6 @@ func (c *ClusterClient) processTxPipeline(ctx context.Context, cmds []Cmder) err
|
|||||||
setCmdsErr(cmds, ErrCrossSlot)
|
setCmdsErr(cmds, ErrCrossSlot)
|
||||||
return ErrCrossSlot
|
return ErrCrossSlot
|
||||||
}
|
}
|
||||||
if len(cmdsMap) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
for slot, cmds := range cmdsMap {
|
for slot, cmds := range cmdsMap {
|
||||||
node, err := state.slotMasterNode(slot)
|
node, err := state.slotMasterNode(slot)
|
||||||
|
Reference in New Issue
Block a user