You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 2, 2021. It is now read-only.
FetcherFactory.New() starts a goroutine (go fetcher.run()) without providing a way to wait for that goroutine to finish on shutdown. Basically, Fetcher.run() crashes randomly on every shutdown. What kind of problem that can cause?
Solution
FetcherFactory.New() must return quit channel. When context is cancelled to initiate the shutdown, that channel must be closed eventually.
Then the wait for that shutdown signal must be implemented at every place where New() is called. Including TestFetcherFactory.
Problem
FetcherFactory.New()starts a goroutine (go fetcher.run()) without providing a way to wait for that goroutine to finish on shutdown. Basically,Fetcher.run()crashes randomly on every shutdown. What kind of problem that can cause?Solution
FetcherFactory.New()must return quit channel. When context is cancelled to initiate the shutdown, that channel must be closed eventually.Then the wait for that shutdown signal must be implemented at every place where
New()is called. IncludingTestFetcherFactory.