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

sendStats time.NewTicker did not stop the tick #13

Closed
daheige opened this issue Oct 12, 2020 · 2 comments
Closed

sendStats time.NewTicker did not stop the tick #13

daheige opened this issue Oct 12, 2020 · 2 comments

Comments

@daheige
Copy link

daheige commented Oct 12, 2020

https://github.com/daheige/statsviz/blob/master/statsviz.go#L87

After this operation, the timer will not leak before the function exits. Especially before the service exits smoothly, it is recommended to clean up the timer here.

fix it like this:
tick := time.NewTicker(defaultSendPeriod)
defer tick.Stop()

@arl
Copy link
Owner

arl commented Oct 12, 2020

Oh yes totally, good catch.
Thank you

@arl
Copy link
Owner

arl commented Oct 12, 2020

Fixed in v0.1.1
See 5844697

@arl arl closed this as completed Oct 12, 2020
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

No branches or pull requests

2 participants