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

chore(err): Extract crossslot err and add test

This commit is contained in:
Nedyalko Dyakov
2025-06-17 11:43:28 +03:00
parent 9b71da1801
commit 68c90f78de
3 changed files with 22 additions and 3 deletions

View File

@ -1506,9 +1506,8 @@ func (c *ClusterClient) processTxPipeline(ctx context.Context, cmds []Cmder) err
cmdsMap := c.mapCmdsBySlot(cmds)
// TxPipeline does not support cross slot transaction.
if len(cmdsMap) > 1 {
err := fmt.Errorf("redis: CROSSSLOT Keys in request don't hash to the same slot")
setCmdsErr(cmds, err)
return err
setCmdsErr(cmds, ErrCrossSlot)
return ErrCrossSlot
}
if len(cmdsMap) == 0 {
return nil