Skip to content
Snippets Groups Projects
Commit cd7164f4 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

another go at working around the networink troubles at travis #2109

parent cf71061d
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@
*/
class HTTPMockClient extends HTTPClient {
protected $tries;
protected $lasturl;
/**
* Sets shorter timeout
......@@ -34,11 +35,13 @@ class HTTPMockClient extends HTTPClient {
* @return bool
*/
public function sendRequest($url, $data = '', $method = 'GET') {
$this->lasturl = $url;
$this->tries = 2; // configures the number of retries
$return = false;
while($this->tries) {
$return = parent::sendRequest($url, $data, $method);
if($this->status != -100) break;
if($this->status != -100 && $this->status != 408) break;
usleep((3 - $this->tries) * 250000);
$this->tries--;
}
return $return;
......@@ -53,6 +56,7 @@ class HTTPMockClient extends HTTPClient {
public function errorInfo($info = '') {
return json_encode(
array(
'URL' => $this->lasturl,
'Error' => $this->error,
'Status' => $this->status,
'Body' => $this->resp_body,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment