Skip to content

Commit 683a8ed

Browse files
authored
Merge pull request #12 from keboola/CM-366-ondra
Set default HTTP timeouts
2 parents 92ec747 + fd22ed4 commit 683a8ed

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Google/RestApi.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class RestApi
1818
{
1919
public const API_URI = 'https://www.googleapis.com';
2020
public const OAUTH_URL = 'https://accounts.google.com/o/oauth2/v2/auth';
21+
private const DEFAULT_CONNECT_TIMEOUT = 30;
22+
private const DEFAULT_REQUEST_TIMEOUT = 5 * 60;
2123

2224
/** @var int */
2325
protected $maxBackoffs = 7;
@@ -118,6 +120,8 @@ protected function getClient(string $baseUri = self::API_URI): Client
118120
return new Client([
119121
'base_uri' => $baseUri,
120122
'handler' => $handlerStack,
123+
'connect_timeout' => self::DEFAULT_CONNECT_TIMEOUT,
124+
'timeout' => self::DEFAULT_REQUEST_TIMEOUT,
121125
]);
122126
}
123127

0 commit comments

Comments
 (0)