1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

fix(txpipeline): short curcuit the tx if there are no commands

This commit is contained in:
Nedyalko Dyakov
2025-06-17 14:26:10 +03:00
parent 68c90f78de
commit c22db9a297

View File

@ -1497,6 +1497,10 @@ func (c *ClusterClient) processTxPipeline(ctx context.Context, cmds []Cmder) err
// Trim multi .. exec.
cmds = cmds[1 : len(cmds)-1]
if len(cmds) == 0 {
return nil
}
state, err := c.state.Get(ctx)
if err != nil {
setCmdsErr(cmds, err)
@ -1509,9 +1513,6 @@ func (c *ClusterClient) processTxPipeline(ctx context.Context, cmds []Cmder) err
setCmdsErr(cmds, ErrCrossSlot)
return ErrCrossSlot
}
if len(cmdsMap) == 0 {
return nil
}
for slot, cmds := range cmdsMap {
node, err := state.slotMasterNode(slot)