Skip to content

Commit c22db9a

Browse files
committed
fix(txpipeline): short curcuit the tx if there are no commands
1 parent 68c90f7 commit c22db9a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

osscluster.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,10 @@ func (c *ClusterClient) processTxPipeline(ctx context.Context, cmds []Cmder) err
14971497
// Trim multi .. exec.
14981498
cmds = cmds[1 : len(cmds)-1]
14991499

1500+
if len(cmds) == 0 {
1501+
return nil
1502+
}
1503+
15001504
state, err := c.state.Get(ctx)
15011505
if err != nil {
15021506
setCmdsErr(cmds, err)
@@ -1509,9 +1513,6 @@ func (c *ClusterClient) processTxPipeline(ctx context.Context, cmds []Cmder) err
15091513
setCmdsErr(cmds, ErrCrossSlot)
15101514
return ErrCrossSlot
15111515
}
1512-
if len(cmdsMap) == 0 {
1513-
return nil
1514-
}
15151516

15161517
for slot, cmds := range cmdsMap {
15171518
node, err := state.slotMasterNode(slot)

0 commit comments

Comments
 (0)