From c22db9a297031f7f67669b77c952fa7ae786eabf Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Tue, 17 Jun 2025 14:26:10 +0300 Subject: [PATCH] fix(txpipeline): short curcuit the tx if there are no commands --- osscluster.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osscluster.go b/osscluster.go index 71c9a892..0dce50a4 100644 --- a/osscluster.go +++ b/osscluster.go @@ -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)