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

fix: Ring.Pipelined return dial timeout error (#3403)

* [ISSUE-3402]: Ring.Pipelined return dial timeout error

* review fixes

---------

Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
This commit is contained in:
Nikita Semenov
2025-07-03 14:48:06 +07:00
committed by GitHub
parent d924f7ea68
commit 7ac4021ae0
2 changed files with 28 additions and 3 deletions

16
ring.go
View File

@ -798,6 +798,8 @@ func (c *Ring) generalProcessPipeline(
}
var wg sync.WaitGroup
errs := make(chan error, len(cmdsMap))
for hash, cmds := range cmdsMap {
wg.Add(1)
go func(hash string, cmds []Cmder) {
@ -810,16 +812,24 @@ func (c *Ring) generalProcessPipeline(
return
}
hook := shard.Client.processPipelineHook
if tx {
cmds = wrapMultiExec(ctx, cmds)
_ = shard.Client.processTxPipelineHook(ctx, cmds)
} else {
_ = shard.Client.processPipelineHook(ctx, cmds)
hook = shard.Client.processTxPipelineHook
}
if err = hook(ctx, cmds); err != nil {
errs <- err
}
}(hash, cmds)
}
wg.Wait()
close(errs)
if err := <-errs; err != nil {
return err
}
return cmdsFirstErr(cmds)
}