So long story short i was stuck with this old PHP utility that is using an old zend framework. I am having trouble when it times-out it doesnt retry so it fails. i have done everything from changing timeout timers to changing max redirects and everything else i can do with the settings and still get the same thing.
I get a consistent
Fatal error: Uncaught exception 'Zend_Http_Client_Exception' with message 'Unable to read response, or response is empty'
and if i happen to try it enough it will work without issue. its just getting to retry it is the problem.
Im not sure where to think to put the retry logic.
I've seen some say it would go somewhere here (Zend_http_client)
public function request($method = null)
{
if (! $this->uri instanceof Zend_Uri_Http) {
/** @see Zend_Http_Client_Exception */
require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception('No valid URI has been passed to the client');
}
if ($method) {
$this->setMethod($method);
}
$this->redirectCounter = 0;
$response = null;
// Make sure the adapter is loaded
if ($this->adapter == null) {
$this->setAdapter($this->config['adapter']);
}
// Send the first request. If redirected, continue.
do {
// Clone the URI and add the additional GET parameters to it
$uri = clone $this->uri;
if (! empty($this->paramsGet)) {
$query = $uri->getQuery();
if (! empty($query)) {
$query .= '&';
}
$query .= http_build_query($this->paramsGet, null, '&');
$uri->setQuery($query);
}
$body = $this->_prepareBody();
$headers = $this->_prepareHeaders();
// Open the connection, send the request and read the response
$this->adapter->connect($uri->getHost(), $uri->getPort(),
($uri->getScheme() == 'https' ? true : false));
$this->last_request = $this->adapter->write($this->method,
$uri, $this->config['httpversion'], $headers, $body);
$response = $this->adapter->read();
if (! $response) {
/** @see Zend_Http_Client_Exception */
require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception('Unable to read response, or response is empty');
}
$response = Zend_Http_Response::fromString($response);
if ($this->config['storeresponse']) {
$this->last_response = $response;
}
I was thinking it could also go here (in my own code)
$eventResponse = new Response($Client->Event(
$theEvent,null));
if (!$throwEventResponse->getResponseStatusOk()) {
$ex = new ResponseException("Unable to complete event.");
$ex->setErrorList($throwEventResponse->getErrorList());
throw $ex;
}
Im at a bit of a loss and im not sure how to go about it to best work for what i need.
Thanks in advance!
Found that by changing the type of HTTP request from HTML 1.1 to 1.0 fixed the issue i was having with the calls moving to the next without waiting for the previous call to finish.
pushing the second request before the other was done caused a weird caching issue and the request failed.