Skip to content

Commit 77e5979

Browse files
bug #62652 [HttpClient] CachingHttpClient must run after UriTemplate and Scoping (Lctrs)
This PR was merged into the 7.4 branch. Discussion ---------- [HttpClient] CachingHttpClient must run after UriTemplate and Scoping | Q | A | ------------- | --- | Branch? |7.4 | Bug fix? | yes | New feature? | no <!-- if yes, also update src/**/CHANGELOG.md --> | Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md --> | Issues | Fix #62590 <!-- prefix each issue number with "Fix #"; no need to create an issue if none exists, explain below --> | License | MIT CachingHttpClient needs the final resolved URL (base_uri from ScopingHttpClient + expanded URI templates) to compute correct cache keys. Commits ------- 4bb94a7c521 [HttpClient] CachingHttpClient must run after UriTemplate and Scoping
2 parents a595281 + 17d0833 commit 77e5979

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2870,20 +2870,20 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder
28702870
unset($scopeConfig['retry_failed']);
28712871

28722872
// This "transport" service is decorated in the following order:
2873-
// 1. ThrottlingHttpClient (30) -> throttles requests
2874-
// 2. UriTemplateHttpClient (25) -> expands URI templates
2875-
// 3. ScopingHttpClient (20) -> resolves relative URLs and applies scope configuration
2876-
// 4. CachingHttpClient (15) -> caches responses
2877-
// 5. RetryableHttpClient (10) -> retries requests
2878-
// 6. TraceableHttpClient (5) -> traces requests
2873+
// 1. ThrottlingHttpClient (5) -> throttles requests
2874+
// 2. UriTemplateHttpClient (10) -> expands URI templates
2875+
// 3. ScopingHttpClient (15) -> resolves relative URLs and applies scope configuration
2876+
// 4. CachingHttpClient (20) -> caches responses
2877+
// 5. RetryableHttpClient (25) -> retries requests
2878+
// 6. TraceableHttpClient (100) -> traces requests
28792879
$container->register($name, HttpClientInterface::class)
28802880
->setFactory('current')
28812881
->setArguments([[new Reference('http_client.transport')]])
28822882
->addTag('http_client.client')
28832883
;
28842884

28852885
$scopingDefinition = $container->register($name.'.scoping', ScopingHttpClient::class)
2886-
->setDecoratedService($name, null, 20)
2886+
->setDecoratedService($name, null, 15)
28872887
->addTag('kernel.reset', ['method' => 'reset', 'on_invalid' => 'ignore']);
28882888

28892889
if (null === $scope) {
@@ -2912,7 +2912,7 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder
29122912

29132913
$container
29142914
->register($name.'.uri_template', UriTemplateHttpClient::class)
2915-
->setDecoratedService($name, null, 25)
2915+
->setDecoratedService($name, null, 10)
29162916
->setArguments([
29172917
new Reference('.inner'),
29182918
new Reference('http_client.uri_template_expander', ContainerInterface::NULL_ON_INVALID_REFERENCE),
@@ -2951,7 +2951,7 @@ private function registerCachingHttpClient(array $options, array $defaultOptions
29512951

29522952
$container
29532953
->register($name.'.caching', CachingHttpClient::class)
2954-
->setDecoratedService($name, null, 15)
2954+
->setDecoratedService($name, null, 20)
29552955
->setArguments([
29562956
new Reference('.inner'),
29572957
new Reference($options['cache_pool']),
@@ -2976,7 +2976,7 @@ private function registerThrottlingHttpClient(string $rateLimiter, string $name,
29762976

29772977
$container
29782978
->register($name.'.throttling', ThrottlingHttpClient::class)
2979-
->setDecoratedService($name, null, 30)
2979+
->setDecoratedService($name, null, 5)
29802980
->setArguments([new Reference('.inner'), new Reference($name.'.throttling.limiter')]);
29812981
}
29822982

@@ -3008,7 +3008,7 @@ private function registerRetryableHttpClient(array $options, string $name, Conta
30083008

30093009
$container
30103010
->register($name.'.retryable', RetryableHttpClient::class)
3011-
->setDecoratedService($name, null, 10)
3011+
->setDecoratedService($name, null, 25)
30123012
->setArguments([new Reference('.inner'), $retryStrategy, $options['max_retries'], new Reference('logger')])
30133013
->addTag('monolog.logger', ['channel' => 'http_client']);
30143014
}

0 commit comments

Comments
 (0)