Skip to content

Commit

Permalink
fix: gorouting leak on redis lock
Browse files Browse the repository at this point in the history
  • Loading branch information
aldor007 committed Oct 19, 2022
1 parent 4dc8475 commit 453bc3c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/lock/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ func (m *RedisLock) Lock(ctx context.Context, key string) (result LockResult, ok
select {
case <-ch:
m.NotifyAndRelease(ctx, key, nil)
case <-result.Cancel:
m.memoryLock.Release(ctx, key)
pubsub.Close()
case <-ctx.Done():
m.memoryLock.Release(ctx, key)
pubsub.Close()
return
}
}
}()
Expand Down

0 comments on commit 453bc3c

Please # to comment.