-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle][HttpClient] Add ThrottlingHttpClient
to limit requests within a timeframe
#53550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8c8ad49
to
e70c356
Compare
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
5b676f0
to
e554083
Compare
...y/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_rate_limiter.yml
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpClient/Tests/ThrottlingHttpClientTest.php
Outdated
Show resolved
Hide resolved
27cfc2c
to
8d43eb7
Compare
Can you please help me get the steps that achieve the throttling? Which part is sleeping especially? The lock is, right? |
@nicolas-grekas Actually no, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the insights, makes sense now.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
84c8927
to
1a8b068
Compare
…uests within a timeframe
1a8b068
to
5bb5474
Compare
Thank you @HypeMC. |
This PR adds a simple
ThrottlingHttpClient
to help with limiting the number of requests within a certain period.Simple example, don't send more than 10 requests in 5 second:
Receiving controller:
Output: