I have a time ticker that will execute a function within time interval(eg every 5 minutes, 10 minutes). I create this time ticker within a goroutine. I heard that this kind of ticker could leak the memory even if the app stopped. This ticker will keep running as long as the app running. Should it stop? how to stop it properly? Here is my implementation:
go func() {
for range time.Tick(5 * time.Minute) {
ExecuteFunctionA()
}
}()
What is the proper implementation for time ticker like this?