mirror of https://github.com/go-redis/redis.git
fix: fix the withHook func
Signed-off-by: monkey <golang@88.com>
This commit is contained in:
parent
4f38f2368d
commit
0ed4a4420f
8
redis.go
8
redis.go
|
@ -158,8 +158,8 @@ func (hs *hooks) setDefaultHook(d defaultHook) {
|
|||
}
|
||||
|
||||
func (hs *hooks) withProcessHook(ctx context.Context, cmd Cmder, hook ProcessHook) error {
|
||||
for _, h := range hs.slice {
|
||||
if wrapped := h.ProcessHook(hook); wrapped != nil {
|
||||
for i := len(hs.slice) - 1; i >= 0; i-- {
|
||||
if wrapped := hs.slice[i].ProcessHook(hook); wrapped != nil {
|
||||
hook = wrapped
|
||||
}
|
||||
}
|
||||
|
@ -169,8 +169,8 @@ func (hs *hooks) withProcessHook(ctx context.Context, cmd Cmder, hook ProcessHoo
|
|||
func (hs *hooks) withProcessPipelineHook(
|
||||
ctx context.Context, cmds []Cmder, hook ProcessPipelineHook,
|
||||
) error {
|
||||
for _, h := range hs.slice {
|
||||
if wrapped := h.ProcessPipelineHook(hook); wrapped != nil {
|
||||
for i := len(hs.slice) - 1; i >= 0; i-- {
|
||||
if wrapped := hs.slice[i].ProcessPipelineHook(hook); wrapped != nil {
|
||||
hook = wrapped
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue