@@ -862,37 +862,6 @@ If you use for example
862862as the type and name of an argument, autowiring will inject the ``my_api.client ``
863863service into your autowired classes.
864864
865- .. _reference-http-client-retry-failed :
866-
867- By enabling the optional ``retry_failed `` configuration, the HTTP client service
868- will automatically retry failed HTTP requests.
869-
870- .. code-block :: yaml
871-
872- # config/packages/framework.yaml
873- framework :
874- # ...
875- http_client :
876- # ...
877- default_options :
878- retry_failed :
879- # retry_strategy: app.custom_strategy
880- http_codes :
881- 0 : ['GET', 'HEAD'] # retry network errors if request method is GET or HEAD
882- 429 : true # retry all responses with 429 status code
883- 500 : ['GET', 'HEAD']
884- max_retries : 2
885- delay : 1000
886- multiplier : 3
887- max_delay : 5000
888- jitter : 0.3
889-
890- scoped_clients :
891- my_api.client :
892- # ...
893- retry_failed :
894- max_retries : 4
895-
896865auth_basic
897866..........
898867
@@ -1003,6 +972,12 @@ crypto_method
1003972The minimum version of TLS to accept. The value must be one of the
1004973``STREAM_CRYPTO_METHOD_TLSv*_CLIENT `` constants defined by PHP.
1005974
975+ .. versionadded :: 6.3
976+
977+ The ``crypto_method `` option was introduced in Symfony 6.3.
978+
979+ .. _reference-http-client-retry-delay :
980+
1006981delay
1007982.....
1008983
@@ -1038,6 +1013,8 @@ headers
10381013An associative array of the HTTP headers added before making the request. This
10391014value must use the format ``['header-name' => 'value0, value1, ...'] ``.
10401015
1016+ .. _reference-http-client-retry-http-codes :
1017+
10411018http_codes
10421019..........
10431020
@@ -1053,6 +1030,8 @@ http_version
10531030The HTTP version to use, typically ``'1.1' `` or ``'2.0' ``. Leave it to ``null ``
10541031to let Symfony select the best version automatically.
10551032
1033+ .. _reference-http-client-retry-jitter :
1034+
10561035jitter
10571036......
10581037
@@ -1080,6 +1059,8 @@ local_pk
10801059The path of a file that contains the `PEM formatted `_ private key of the
10811060certificate defined in the ``local_cert `` option.
10821061
1062+ .. _reference-http-client-retry-max-delay :
1063+
10831064max_delay
10841065.........
10851066
@@ -1114,6 +1095,8 @@ max_redirects
11141095The maximum number of redirects to follow. Use ``0 `` to not follow any
11151096redirection.
11161097
1098+ .. _reference-http-client-retry-max-retries :
1099+
11171100max_retries
11181101...........
11191102
@@ -1122,6 +1105,8 @@ max_retries
11221105The maximum number of retries for failing requests. When the maximum is reached,
11231106the client returns the last received response.
11241107
1108+ .. _reference-http-client-retry-multiplier :
1109+
11251110multiplier
11261111..........
11271112
@@ -1202,6 +1187,54 @@ client and to make your tests easier.
12021187The value of this option is an associative array of ``domain => IP address ``
12031188(e.g ``['symfony.com' => '46.137.106.254', ...] ``).
12041189
1190+ .. _reference-http-client-retry-failed :
1191+
1192+ retry_failed
1193+ ............
1194+
1195+ **type **: ``array ``
1196+
1197+ .. versionadded :: 5.2
1198+
1199+ The ``retry_failed `` option was introduced in Symfony 5.2.
1200+
1201+ This option configures the behavior of the HTTP client when some request fails,
1202+ including which types of requests to retry and how many times. The behavior is
1203+ defined with the following options:
1204+
1205+ * :ref: `delay <reference-http-client-retry-delay >`
1206+ * :ref: `http_codes <reference-http-client-retry-http-codes >`
1207+ * :ref: `jitter <reference-http-client-retry-jitter >`
1208+ * :ref: `max_delay <reference-http-client-retry-max-delay >`
1209+ * :ref: `max_retries <reference-http-client-retry-max-retries >`
1210+ * :ref: `multiplier <reference-http-client-retry-multiplier >`
1211+
1212+ .. code-block :: yaml
1213+
1214+ # config/packages/framework.yaml
1215+ framework :
1216+ # ...
1217+ http_client :
1218+ # ...
1219+ default_options :
1220+ retry_failed :
1221+ # retry_strategy: app.custom_strategy
1222+ http_codes :
1223+ 0 : ['GET', 'HEAD'] # retry network errors if request method is GET or HEAD
1224+ 429 : true # retry all responses with 429 status code
1225+ 500 : ['GET', 'HEAD']
1226+ max_retries : 2
1227+ delay : 1000
1228+ multiplier : 3
1229+ max_delay : 5000
1230+ jitter : 0.3
1231+
1232+ scoped_clients :
1233+ my_api.client :
1234+ # ...
1235+ retry_failed :
1236+ max_retries : 4
1237+
12051238 retry_strategy
12061239..............
12071240
0 commit comments