@@ -1521,8 +1521,8 @@ func (c *ClusterClient) processTxPipeline(ctx context.Context, cmds []Cmder) err
1521
1521
1522
1522
cmdsMap := map [int ][]Cmder {}
1523
1523
slot := - 1
1524
- // split keyed and keyless commands
1525
- keyedCmds , _ := c .keyedAndKeyessCmds (cmds )
1524
+ // get only the keyed commands
1525
+ keyedCmds := c .keyedCmds (cmds )
1526
1526
if len (keyedCmds ) == 0 {
1527
1527
// no keyed commands try random slot
1528
1528
slot = hashtag .RandomSlot ()
@@ -1600,17 +1600,17 @@ func (c *ClusterClient) mapCmdsBySlot(cmds []Cmder) map[int][]Cmder {
1600
1600
}
1601
1601
return cmdsMap
1602
1602
}
1603
- func (c * ClusterClient ) keyedAndKeyessCmds (cmds []Cmder ) ([]Cmder , []Cmder ) {
1603
+
1604
+ // keyedCmds returns all the keyed commands from the cmds slice
1605
+ // it determines keyed commands by checking if the command has a first key position
1606
+ func (c * ClusterClient ) keyedCmds (cmds []Cmder ) []Cmder {
1604
1607
keyedCmds := make ([]Cmder , 0 , len (cmds ))
1605
- keylessCmds := make ([]Cmder , 0 , len (cmds ))
1606
1608
for _ , cmd := range cmds {
1607
- if cmdFirstKeyPos (cmd ) == 0 {
1608
- keylessCmds = append (keylessCmds , cmd )
1609
- } else {
1609
+ if cmdFirstKeyPos (cmd ) != 0 {
1610
1610
keyedCmds = append (keyedCmds , cmd )
1611
1611
}
1612
1612
}
1613
- return keyedCmds , keylessCmds
1613
+ return keyedCmds
1614
1614
}
1615
1615
1616
1616
func (c * ClusterClient ) processTxPipelineNode (
0 commit comments