Skip to content

Commit

Permalink
Merge pull request #313 from SamuelSarle/master
Browse files Browse the repository at this point in the history
Fix resource leak from time.NewTicker
  • Loading branch information
thrawn01 committed Nov 6, 2023
2 parents b3130dc + ba99848 commit d9eae83
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 d9eae83

Please sign in to comment.