Skip to content

Commit 7880c99

Browse files
adamwymyaming.wang
andauthored
Fix ticker leak when unlocking with auto extend (#137)
Co-authored-by: yaming.wang <[email protected]>
1 parent 02e5451 commit 7880c99

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

redislock.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ func (r *redisLock) Unlock(ctx context.Context) error {
119119

120120
func (r *redisLock) doExtend() {
121121
ticker := time.NewTicker(r.autoExtendDuration)
122+
defer ticker.Stop()
123+
122124
for {
123125
select {
124126
case <-r.done:

0 commit comments

Comments
 (0)