Commit 03b6e4f7 authored by Ján Forgáč's avatar Ján Forgáč

Toptrans API is slow, use longer timeouts; could be overridden

parent a96fa689
......@@ -17,8 +17,8 @@ class Request
const API_HOST = 'https://zp.toptrans.cz';
const API_BASE_PATH = '/api/json';
const CONNECTION_TIMEOUT = 2; // sec
const TIMEOUT = 4; // sec
const CONNECTION_TIMEOUT = 30; // sec
const TIMEOUT = 45; // sec
/** @var string */
private $username;
......@@ -66,4 +66,24 @@ class Request
return $decodedResponse;
}
/**
* @param int $timeout
* @return $this
*/
public function setTimeout($timeout)
{
$this->timeout = $timeout;
return $this;
}
/**
* @param int $connectionTimeout
* @return $this
*/
public function setConnectionTimeout($connectionTimeout)
{
$this->connectionTimeout = $connectionTimeout;
return $this;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment