From ff41cf77b4ce422d9866a3efd15261c2b2934a68 Mon Sep 17 00:00:00 2001 From: Alexey Kiselev Date: Wed, 11 Dec 2024 12:40:13 +0400 Subject: [PATCH] Prepare for new timer in Go 1.23 Co-authored-by: Nikolay Eskov --- pkg/networking/timers.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/networking/timers.go b/pkg/networking/timers.go index 5f2d2949f..6492297a8 100644 --- a/pkg/networking/timers.go +++ b/pkg/networking/timers.go @@ -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) }