Skip to content

Commit

Permalink
Merge pull request #17 from answear/add-default-timeout
Browse files Browse the repository at this point in the history
Add default timeout
  • Loading branch information
Wiktor6 authored Sep 3, 2024
2 parents 0afa526 + d423c30 commit 5dd10b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Client/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

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

private ClientInterface $client;
private RequestTransformer $transformer;
private OverseasLogger $overseasLogger;
Expand All @@ -24,7 +27,7 @@ public function __construct(
) {
$this->transformer = $transformer;
$this->overseasLogger = $overseasLogger;
$this->client = $client ?? new \GuzzleHttp\Client();
$this->client = $client ?? new \GuzzleHttp\Client(['timeout' => self::TIMEOUT, 'connect_timeout' => self::CONNECTION_TIMEOUT]);
}

public function request(RequestInterface $request): ResponseInterface
Expand Down

0 comments on commit 5dd10b9

Please sign in to comment.