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

To stop ticker explicitly #20

Closed
maliyan opened this issue Dec 28, 2022 · 1 comment
Closed

To stop ticker explicitly #20

maliyan opened this issue Dec 28, 2022 · 1 comment

Comments

@maliyan
Copy link

maliyan commented Dec 28, 2022

10.1 #75 Providing a wrong time duration should stop ticker, or cause leaks

ticker := time.NewTicker(1000) // should stop defer
for {
    select {
    case <-ticker.C:
        // Do something
    }
}
ticker := time.NewTicker(1000)
defer ticker.Stop()
for {
    select {
    case <-ticker.C:
        // Do something
    }
}
@teivah
Copy link
Owner

teivah commented Jan 6, 2023

Thanks but this code is an excerpt (we don't see the whole function) and don't focus on the ticker so I don't consider it an issue.

@teivah teivah closed this as completed Jan 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

No branches or pull requests

2 participants