Skip to content

Commit

Permalink
CURL Connection timeout
Browse files Browse the repository at this point in the history
Default value is 300 seconds and in some cases it may be too long
  • Loading branch information
NikolaySav authored Jun 4, 2020
1 parent 64b52ab commit f79648a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Request/Requester/CurlRequester.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,26 @@ class CurlRequester extends AbstractRequester
*/
private $sslVersion = 1;

/**
* @var int
*/
private $curlConnectTimeout = 300;

/**
* @param int $sslVersion
*/
public function setSSLVersion($sslVersion)
{
$this->sslVersion = $sslVersion;
}

/**
* @param int $timeout
*/
public function setCurlConnectTimeout($timeout)
{
$this->curlConnectTimeout = $timeout;
}

/**
* @param AbstractRequest $request
Expand All @@ -40,6 +53,7 @@ protected function request(AbstractRequest $request)

$handler = curl_init($request->getUrl());

curl_setopt($handler, CURLOPT_CONNECTTIMEOUT, $this->curlConnectTimeout);
curl_setopt($handler, CURLOPT_POST, true);
curl_setopt($handler, CURLOPT_POSTFIELDS, $request->getData());

Expand Down

0 comments on commit f79648a

Please sign in to comment.