Merge branch 'cc-5709-airtime-analyzer' into cc-5709-airtime-analyzer-saas

This commit is contained in:
drigato 2014-05-08 13:02:22 -04:00
commit c9ddcc28e0
2 changed files with 8 additions and 4 deletions

View File

@ -362,7 +362,7 @@ class Rest_MediaController extends Zend_Rest_Controller
private function invalidDataResponse() private function invalidDataResponse()
{ {
$resp = $this->getResponse(); $resp = $this->getResponse();
$resp->setHttpResponseCode(400); $resp->setHttpResponseCode(422);
$resp->appendBody("ERROR: Invalid data"); $resp->appendBody("ERROR: Invalid data");
} }

View File

@ -91,9 +91,13 @@ def send_http_request(picklable_request, retry_queue):
r.raise_for_status() # Raise an exception if there was an http error code returned r.raise_for_status() # Raise an exception if there was an http error code returned
logging.info("HTTP request sent successfully.") logging.info("HTTP request sent successfully.")
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
# If the web server is having problems, retry the request later: if r.status_code != 422:
logging.error("HTTP request failed. Retrying later! Exception was: %s" % str(e)) # If the web server is having problems, retry the request later:
retry_queue.append(picklable_request) logging.error("HTTP request failed. Retrying later! Exception was: %s" % str(e))
retry_queue.append(picklable_request)
else:
# Do no retry the request if there was a metadata validation error
logging.error("HTTP request failed. Exception was: %s" % str(e))
except Exception as e: except Exception as e:
logging.error("HTTP request failed with unhandled exception. %s" % str(e)) logging.error("HTTP request failed with unhandled exception. %s" % str(e))
# Don't put the request into the retry queue, just give up on this one. # Don't put the request into the retry queue, just give up on this one.