Skip to content

Commit

Permalink
Prepare for new timer in Go 1.23
Browse files Browse the repository at this point in the history
Co-authored-by: Nikolay Eskov <[email protected]>
  • Loading branch information
alexeykiselev and nickeskov authored Dec 11, 2024
1 parent 5219227 commit ff41cf7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/networking/timers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ func (p *timerPool) Get() *time.Timer {
}

func (p *timerPool) Put(t *time.Timer) {
t.Stop()
select {
case <-t.C:
default:
if !t.Stop() {
select {
case <-t.C:
default:
}
}
p.p.Put(t)
}

0 comments on commit ff41cf7

Please sign in to comment.