-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
It looks like GlobalTimeCache was removed on master due to a separate issue, but I wanted to highlight another problem I’ve run into in case it is re-added. And this issue might just be a misunderstanding on my part, so feel free to treat it as a discussion point.
I discovered the issue through a unit test of mine that checks for leaked goroutines. GlobalTimeCache starts a goroutine in an init() function, which means the goroutine is launched as soon as the package is imported. What’s unclear to me is how this goroutine is supposed to be stopped.
If I create a client and call client.Close(), that does stop the goroutine — but that feels odd, because calling Close() on a single client shouldn’t be responsible for shutting down what is intended to be a global resource.
And in the case of my unit test, I wasn't evening using redis in the scope of the test, but because redis was imported by a package this test imports, the goroutine was spawned.