Skip to content

Commit

Permalink
Merge pull request #6 from answear/ANS-18103-timeout-for-guzzle-client
Browse files Browse the repository at this point in the history
ANS-18103 - timeout for guzzle client
  • Loading branch information
lukasz-falda authored Sep 12, 2024
2 parents 826dea1 + 8c782ae commit 7c08d6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Service/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@

class Client
{
private const CONNECTION_TIMEOUT = 10;
private const TIMEOUT = 30;

protected ConfigProvider $configProvider;
protected ClientInterface $guzzle;

public function __construct(ConfigProvider $configProvider, ?ClientInterface $client = null)
{
$this->configProvider = $configProvider;
$this->guzzle = $client ?? new \GuzzleHttp\Client();
$this->guzzle = $client ?? new \GuzzleHttp\Client(['timeout' => self::TIMEOUT, 'connect_timeout' => self::CONNECTION_TIMEOUT]);
}

public function request(Request $request): array
Expand Down

0 comments on commit 7c08d6f

Please sign in to comment.