Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resource leak from time.NewTicker #313

Merged
merged 1 commit into from
Nov 6, 2023
Merged

Conversation

SamuelSarle
Copy link
Contributor

Currently resources are leaked when EventPoller.Poll() returns from the <-ctx.Done() branch of the select because a time.Ticker must be stopped to release associated resources.

This PR fixes the issue by adding a .Stop() call on the branch. The time.Ticker is also switched to a time.Timer since only one event is used and time.Timer is more suitable. Alternatively, it would be enough to just add a .Stop() call for time.Ticker.

Copy link
Contributor

@thrawn01 thrawn01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

@thrawn01 thrawn01 merged commit d9eae83 into mailgun:master Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants