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
Is there some way to disable the builtin ratelimiting started in NewClient()?
Our calling pattern makes it hard to share clients across requests, and so we would prefer to create a new client per request and do our own higher-level ratelimiting.
AFAICT the current implementation of NewClient() starts a goroutine which will never exit, since the ratelimiter channel it feeds is never closed. Additionally, it seems to be using time.Tick(), in which case the ticker 'cannot be recovered by the garbage collector; it "leaks,"' (time Godoc) so we leak 2 things per client.
Am I misunderstanding the code? If not, is there some way I'm overlooking to close the ratelimiter-related resources, or disable it entirely? If not that, then how do you feel about my adding it?
The text was updated successfully, but these errors were encountered:
This feels like a fairly major change, where in we would need to create a "one shot" client that doesn't have rate limiting associated with the client.
I'm happy to review a pull request for this, but maybe a fork is more appropriate for your change? It feels like you could wind up with a much simpler client due to your higher level rate limiting functionality.
Is there some way to disable the builtin ratelimiting started in
NewClient()
?Our calling pattern makes it hard to share clients across requests, and so we would prefer to create a new client per request and do our own higher-level ratelimiting.
AFAICT the current implementation of
NewClient()
starts a goroutine which will never exit, since the ratelimiter channel it feeds is never closed. Additionally, it seems to be usingtime.Tick()
, in which case the ticker 'cannot be recovered by the garbage collector; it "leaks,"' (time Godoc) so we leak 2 things per client.Am I misunderstanding the code? If not, is there some way I'm overlooking to close the ratelimiter-related resources, or disable it entirely? If not that, then how do you feel about my adding it?
The text was updated successfully, but these errors were encountered: