-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[HttpClient] Add documentation for Retryable client #14253
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,7 @@ Some options are described in this guide: | |
* `Query String Parameters`_ | ||
* `Headers`_ | ||
* `Redirects`_ | ||
* `Retry Failed Requests`_ | ||
* `HTTP Proxies`_ | ||
|
||
Check out the full :ref:`http_client config reference <reference-http-client>` | ||
|
@@ -654,6 +655,28 @@ making a request. Use the ``max_redirects`` setting to configure this behavior | |
'max_redirects' => 0, | ||
]); | ||
|
||
Retry Failed Requests | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Some times, requests failed because of temporary issue in the server or | ||
because network issue. You can use the | ||
:class:`Symfony\\Component\\HttpClient\\RetryableHttpClient` | ||
client to automatically retry the request when it fails.:: | ||
|
||
use Symfony\Component\HttpClient\RetryableHttpClient; | ||
|
||
$client = new RetryableHttpClient(HttpClient::create()); | ||
|
||
The ``RetryableHttpClient`` uses a | ||
:class:`Symfony\\Component\\HttpClient\\Retry\\RetryDeciderInterface` to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think we need a section to explain how user can implement their own Decider and BackOff ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not necessary because we no longer document components on its own, but when used inside a Symfony app. Thanks! |
||
decide if the request should be retried, and a | ||
:class:`Symfony\\Component\\HttpClient\\Retry\\RetryBackOffInterface` to | ||
define the waiting time between each retry. | ||
|
||
By default, it retries until 3 attemps, the requests responding with a | ||
status code in (423, 425, 429, 500, 502, 503, 504, 507 or 510) and wait | ||
javiereguiluz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
expentially from 1 second for the first retry, to 4 seconds at the 3rd attempt. | ||
|
||
HTTP Proxies | ||
~~~~~~~~~~~~ | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.