From ba99848aac657a416589f1203fa91c10565b298a Mon Sep 17 00:00:00 2001 From: Samuel Sarle Date: Wed, 20 Sep 2023 18:11:33 +0400 Subject: [PATCH] Fix leaking ticker --- events.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/events.go b/events.go index 8e7a7683..a9ce2af2 100644 --- a/events.go +++ b/events.go @@ -277,12 +277,12 @@ func (ep *EventPoller) Poll(ctx context.Context, events *[]Event) bool { ep.it.Paging.Next = currentPage // Sleep the rest of our duration - tick := time.NewTicker(ep.opts.PollInterval) + timer := time.NewTimer(ep.opts.PollInterval) select { case <-ctx.Done(): + timer.Stop() return false - case <-tick.C: - tick.Stop() + case <-timer.C: } }