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
->integerNode('delay')->defaultValue(1000)->min(0)->info('Time in ms to delay (or the initial value when multiplier is used)')->end()
1507
-
->floatNode('multiplier')->defaultValue(2)->min(1)->info('If greater than 1, delay will grow exponentially for each retry: this delay = (delay * (multiple ^ retries))')->end()
1508
-
->integerNode('max_delay')->defaultValue(0)->min(0)->info('Max time in ms that a retry should ever be delayed (0 = infinite)')->end()
1509
-
->end()
1510
-
->end()
1476
+
->append($this->addHttpClientRetrySection())
1511
1477
->end()
1512
1478
->end()
1513
1479
->scalarNode('mock_response_factory')
@@ -1650,43 +1616,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode)
1650
1616
->variableNode('md5')->end()
1651
1617
->end()
1652
1618
->end()
1653
-
->arrayNode('retry_failed')
1654
-
->fixXmlConfig('http_code')
1655
-
->canBeEnabled()
1656
-
->addDefaultsIfNotSet()
1657
-
->beforeNormalization()
1658
-
->always(function ($v) {
1659
-
if (isset($v['backoff_service']) && (isset($v['delay']) || isset($v['multiplier']) || isset($v['max_delay']))) {
1660
-
thrownew \InvalidArgumentException('The "backoff_service" option cannot be used along with the "delay", "multiplier" or "max_delay" options.');
1661
-
}
1662
-
if (isset($v['decider_service']) && (isset($v['http_codes']))) {
1663
-
thrownew \InvalidArgumentException('The "decider_service" option cannot be used along with the "http_codes" options.');
1664
-
}
1665
-
1666
-
return$v;
1667
-
})
1668
-
->end()
1669
-
->children()
1670
-
->scalarNode('backoff_service')->defaultNull()->info('service id to override the retry backoff entirely')->end()
1671
-
->scalarNode('decider_service')->defaultNull()->info('service id to override the retry decider entirely')->end()
1672
-
->arrayNode('http_codes')
1673
-
->performNoDeepMerging()
1674
-
->beforeNormalization()
1675
-
->ifArray()
1676
-
->then(function ($v) {
1677
-
returnarray_filter(array_values($v));
1678
-
})
1679
-
->end()
1680
-
->prototype('scalar')->end()
1681
-
->info('A list of HTTP status code that triggers a retry')
->integerNode('delay')->defaultValue(1000)->min(0)->info('Time in ms to delay (or the initial value when multiplier is used)')->end()
1686
-
->floatNode('multiplier')->defaultValue(2)->min(1)->info('If greater than 1, delay will grow exponentially for each retry: this delay = (delay * (multiple ^ retries))')->end()
1687
-
->integerNode('max_delay')->defaultValue(0)->min(0)->info('Max time in ms that a retry should ever be delayed (0 = infinite)')->end()
1688
-
->end()
1689
-
->end()
1619
+
->append($this->addHttpClientRetrySection())
1690
1620
->end()
1691
1621
->end()
1692
1622
->end()
@@ -1696,6 +1626,49 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode)
1696
1626
;
1697
1627
}
1698
1628
1629
+
privatefunctionaddHttpClientRetrySection()
1630
+
{
1631
+
$root = newNodeBuilder();
1632
+
return$root
1633
+
->arrayNode('retry_failed')
1634
+
->fixXmlConfig('http_code')
1635
+
->canBeEnabled()
1636
+
->addDefaultsIfNotSet()
1637
+
->beforeNormalization()
1638
+
->always(function ($v) {
1639
+
if (isset($v['backoff_service']) && (isset($v['delay']) || isset($v['multiplier']) || isset($v['max_delay']))) {
1640
+
thrownew \InvalidArgumentException('The "backoff_service" option cannot be used along with the "delay", "multiplier" or "max_delay" options.');
1641
+
}
1642
+
if (isset($v['decider_service']) && (isset($v['http_codes']))) {
1643
+
thrownew \InvalidArgumentException('The "decider_service" option cannot be used along with the "http_codes" options.');
1644
+
}
1645
+
1646
+
return$v;
1647
+
})
1648
+
->end()
1649
+
->children()
1650
+
->scalarNode('backoff_service')->defaultNull()->info('service id to override the retry backoff')->end()
1651
+
->scalarNode('decider_service')->defaultNull()->info('service id to override the retry decider')->end()
1652
+
->arrayNode('http_codes')
1653
+
->performNoDeepMerging()
1654
+
->beforeNormalization()
1655
+
->ifArray()
1656
+
->then(function ($v) {
1657
+
returnarray_filter(array_values($v));
1658
+
})
1659
+
->end()
1660
+
->prototype('integer')->end()
1661
+
->info('A list of HTTP status code that triggers a retry')
->integerNode('delay')->defaultValue(1000)->min(0)->info('Time in ms to delay (or the initial value when multiplier is used)')->end()
1666
+
->floatNode('multiplier')->defaultValue(2)->min(1)->info('If greater than 1, delay will grow exponentially for each retry: (delay * (multiple ^ retries))')->end()
1667
+
->integerNode('max_delay')->defaultValue(0)->min(0)->info('Max time in ms that a retry should ever be delayed (0 = infinite)')->end()
thrownewLogicException('Retry failed request support cannot be enabled as the component is not installed in the right version. Try running "composer require symfony/http-client:^5.2".');
2051
+
if (!class_exists(RetryableHttpClient::class)) {
2052
+
thrownewLogicException('Retry failed request support cannot be enabled as version 5.2+ of the HTTP Client component is required.');
0 commit comments