Skip to content

Commit aac0ea4

Browse files
authored
Merge pull request #1891 from gozeloglu/rmv-empty-fnc
empty hooks.withContext removed
2 parents 9971188 + 028aeaa commit aac0ea4

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

redis.go

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ func (hs hooks) process(
5151
ctx context.Context, cmd Cmder, fn func(context.Context, Cmder) error,
5252
) error {
5353
if len(hs.hooks) == 0 {
54-
err := hs.withContext(ctx, func() error {
55-
return fn(ctx, cmd)
56-
})
54+
err := fn(ctx, cmd)
5755
cmd.SetErr(err)
5856
return err
5957
}
@@ -69,9 +67,7 @@ func (hs hooks) process(
6967
}
7068

7169
if retErr == nil {
72-
retErr = hs.withContext(ctx, func() error {
73-
return fn(ctx, cmd)
74-
})
70+
retErr = fn(ctx, cmd)
7571
cmd.SetErr(retErr)
7672
}
7773

@@ -89,9 +85,7 @@ func (hs hooks) processPipeline(
8985
ctx context.Context, cmds []Cmder, fn func(context.Context, []Cmder) error,
9086
) error {
9187
if len(hs.hooks) == 0 {
92-
err := hs.withContext(ctx, func() error {
93-
return fn(ctx, cmds)
94-
})
88+
err := fn(ctx, cmds)
9589
return err
9690
}
9791

@@ -106,9 +100,7 @@ func (hs hooks) processPipeline(
106100
}
107101

108102
if retErr == nil {
109-
retErr = hs.withContext(ctx, func() error {
110-
return fn(ctx, cmds)
111-
})
103+
retErr = fn(ctx, cmds)
112104
}
113105

114106
for hookIndex--; hookIndex >= 0; hookIndex-- {
@@ -128,10 +120,6 @@ func (hs hooks) processTxPipeline(
128120
return hs.processPipeline(ctx, cmds, fn)
129121
}
130122

131-
func (hs hooks) withContext(ctx context.Context, fn func() error) error {
132-
return fn()
133-
}
134-
135123
//------------------------------------------------------------------------------
136124

137125
type baseClient struct {

0 commit comments

Comments
 (0)