Closed justinmayhew closed 2 months ago
It was important before Go 1.23, now it is not anymore [ref]:
Before Go 1.23, this documentation warned that the underlying Timer would not be recovered by the garbage collector until the timer fired, and that if efficiency was a concern, code should use NewTimer instead and call Timer.Stop if the timer is no longer needed. As of Go 1.23, the garbage collector can recover unreferenced, unstopped timers. There is no reason to prefer NewTimer when After will do.
Closing as no longer needed.
When a batch is triggered by hitting the batch capacity, the timer is no longer needed and the resources associated with it can be released.