We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent be6de83 commit a51ac37Copy full SHA for a51ac37
redislock.go
@@ -109,12 +109,7 @@ func (rd *redisDriver) tryLock(key string) bool {
109
}
110
111
ctx, cancel := context.WithTimeout(context.Background(), redisExecuteTimeout)
112
- go func() {
113
- for range time.After(redisExecuteTimeout) {
114
- cancel()
115
- break
116
- }
117
- }()
+ defer cancel()
118
119
var (
120
ok bool
@@ -176,13 +171,7 @@ func (rd *redisDriver) unlock(key string) {
176
171
177
172
178
173
179
-
180
181
182
183
184
185
174
186
175
187
if rd.client != nil {
188
_, _ = rd.client.Del(ctx, key).Result()
0 commit comments