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
Description
Seems the new feature RateLimiter has been designed to limit the number of request that is coming to an application (inbound). What do you think to use this new feature to control the RateLimit for http request outbound? In order to never reach the rate limit when we are calling an external API which limit the number of request per second, per minute...
Example
I had the idea to use that because existing rate limiter middleware for Guzzle (i.e. https://github.com/spatie/guzzle-rate-limiter-middleware) does not manage "shared rate limiter" across several processes running in same time in parallel. Seems symfony/rate-limiter manages that natively. I tested and seems it works but I would like feedback from experts :-).
I agree with @xabbuh here. I don't see anything Symfony can do here, other than to provide the low level APIs like the RateLimiter component does. Feel free to transform this class into an open source package that you own :)
As for the Symfony HttpClient component, this usecase is already solved in 5.2 by #37471. See also #37471 (comment) for a bit of explanation why this feature doesn't use the RateLimiter component (and I'm unsure if it's the perfect fit for this type of backoff algorithms).
Description
Seems the new feature RateLimiter has been designed to limit the number of request that is coming to an application (inbound). What do you think to use this new feature to control the RateLimit for http request outbound? In order to never reach the rate limit when we are calling an external API which limit the number of request per second, per minute...
Example
I had the idea to use that because existing rate limiter middleware for Guzzle (i.e. https://github.com/spatie/guzzle-rate-limiter-middleware) does not manage "shared rate limiter" across several processes running in same time in parallel. Seems symfony/rate-limiter manages that natively. I tested and seems it works but I would like feedback from experts :-).
The code of the RateLimiterMiddleware for guzzle:
How to add the middleware to guzzle (inside services.yaml:
The text was updated successfully, but these errors were encountered: