Skip to content

Commit

Permalink
add timerPool.Put
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Jun 29, 2023
1 parent 1ae3f52 commit b5c5c68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/tso_dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ func (c *tsoClient) watchTSDeadline(ctx context.Context, dcLocation string) {
timerPool.Put(d.timer)
continue
case <-ctx.Done():
d.timer.Stop() // not received from timer.C, so we need to stop the timer
timerPool.Put(d.timer)
return
}
case <-ctx.Done():
Expand Down
2 changes: 2 additions & 0 deletions pkg/utils/tsoutil/tso_dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ func WatchTSDeadline(ctx context.Context, tsDeadlineCh <-chan *TSDeadline) {
timerPool.Put(d.timer)
continue
case <-ctx.Done():
d.timer.Stop() // not received from timer.C, so we need to stop the timer
timerPool.Put(d.timer)
return
}
case <-ctx.Done():
Expand Down

0 comments on commit b5c5c68

Please sign in to comment.