Skip to content

Commit

Permalink
Fix leaking ticker
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelSarle committed Sep 20, 2023
1 parent b3130dc commit ba99848
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
}
}

Expand Down

0 comments on commit ba99848

Please sign in to comment.