Skip to content

Commit 8599a09

Browse files
committed
Revert "Do not override HttpClient DI"
This reverts commit 70b7f42c48e6386674827077cd53c64a9d2884e5.
1 parent 46353a0 commit 8599a09

File tree

3 files changed

+5
-45
lines changed

3 files changed

+5
-45
lines changed

src/AsyncAwsBundle.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace AsyncAws\Symfony\Bundle;
66

7-
use AsyncAws\Symfony\Bundle\DependencyInjection\Compiler\CreateHttpClientPass;
87
use AsyncAws\Symfony\Bundle\DependencyInjection\Compiler\InjectCasterPass;
98
use Symfony\Component\DependencyInjection\ContainerBuilder;
109
use Symfony\Component\HttpKernel\Bundle\Bundle;
@@ -16,6 +15,5 @@ public function build(ContainerBuilder $container)
1615
parent::build($container);
1716

1817
$container->addCompilerPass(new InjectCasterPass());
19-
$container->addCompilerPass(new CreateHttpClientPass());
2018
}
2119
}

src/DependencyInjection/AsyncAwsExtension.php

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@
88
use AsyncAws\Core\Credentials\ChainProvider;
99
use AsyncAws\Core\Credentials\CredentialProvider;
1010
use AsyncAws\Core\Credentials\SymfonyCacheProvider;
11-
use AsyncAws\Core\HttpClient\AwsRetryStrategy;
1211
use AsyncAws\Symfony\Bundle\Secrets\CachedEnvVarLoader;
1312
use AsyncAws\Symfony\Bundle\Secrets\SsmVault;
1413
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
15-
use Symfony\Component\DependencyInjection\ChildDefinition;
1614
use Symfony\Component\DependencyInjection\ContainerBuilder;
1715
use Symfony\Component\DependencyInjection\ContainerInterface;
1816
use Symfony\Component\DependencyInjection\Definition;
1917
use Symfony\Component\DependencyInjection\Reference;
20-
use Symfony\Component\HttpClient\Retry\RetryStrategyInterface;
21-
use Symfony\Component\HttpClient\RetryableHttpClient;
2218
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
2319
use Symfony\Contracts\Cache\CacheInterface;
2420

@@ -98,17 +94,7 @@ private function addServiceDefinition(ContainerBuilder $container, string $name,
9894
$httpClient = $config['http_client'] ? new Reference($config['http_client']) : null;
9995
} else {
10096
// Use default Symfony http_client unless explicitly set to null.
101-
if (class_exists(RetryableHttpClient::class)) {
102-
$httpClient = new Definition(RetryableHttpClient::class);
103-
$httpClient->setArguments([
104-
new Reference('async_aws.http_client'),
105-
new Definition(AwsRetryStrategy::class),
106-
3,
107-
$logger,
108-
]);
109-
} else {
110-
$httpClient = new Reference('async_aws.http_client');
111-
}
97+
$httpClient = new Reference('http_client', ContainerInterface::NULL_ON_INVALID_REFERENCE);
11298
}
11399

114100
// If no credential provider is specified, lets configured a credentials provider with cache.
@@ -140,12 +126,10 @@ private function addServiceDefinition(ContainerBuilder $container, string $name,
140126
}
141127

142128
$definition = new Definition($clientClass);
143-
$definition->setArguments([
144-
$config['config'],
145-
$credentialServiceId ? new Reference($credentialServiceId) : null,
146-
$httpClient,
147-
$logger,
148-
]);
129+
$definition->addArgument($config['config']);
130+
$definition->addArgument($credentialServiceId ? new Reference($credentialServiceId) : null);
131+
$definition->addArgument($httpClient);
132+
$definition->addArgument($logger);
149133
$definition->addTag('monolog.logger', ['channel' => 'async_aws']);
150134
$container->setDefinition(sprintf('async_aws.client.%s', $name), $definition);
151135
}

src/DependencyInjection/Compiler/CreateHttpClientPass.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)