CC-5709: Airtime Analyzer
* Unbreak stuff
This commit is contained in:
parent
eb37b39406
commit
6952902b22
3 changed files with 10 additions and 9 deletions
|
@ -100,6 +100,7 @@ class MessageListener:
|
|||
requeue=False) #Important that it doesn't requeue the message
|
||||
|
||||
except Exception as e:
|
||||
logging.exception(e)
|
||||
#If ANY exception happens while processing a file, we're going to NACK to the
|
||||
#messaging server and tell it to remove the message from the queue.
|
||||
#(NACK is a negative acknowledgement. We could use ACK instead, but this might come
|
||||
|
@ -118,7 +119,6 @@ class MessageListener:
|
|||
StatusReporter.report_failure_to_callback_url(callback_url, api_key, import_status=2,
|
||||
reason=u'An error occurred while importing this file')
|
||||
|
||||
logging.exception(e)
|
||||
|
||||
else:
|
||||
# ACK at the very end, after the message has been successfully processed.
|
||||
|
|
|
@ -15,9 +15,9 @@ class StatusReporter():
|
|||
put_payload = json.dumps(audio_metadata)
|
||||
logging.debug("sending http put with payload: " + put_payload)
|
||||
r = requests.put(callback_url, data=put_payload,
|
||||
auth=requests.auth.httpbasicauth(api_key, ''),
|
||||
timeout=statusreporter._http_request_timeout)
|
||||
logging.debug("http request returned status: " + str(r.status_code))
|
||||
auth=requests.auth.HTTPBasicAuth(api_key, ''),
|
||||
timeout=StatusReporter._HTTP_REQUEST_TIMEOUT)
|
||||
logging.debug("HTTP request returned status: " + str(r.status_code))
|
||||
logging.debug(r.text) # log the response body
|
||||
|
||||
#todo: queue up failed requests and try them again later.
|
||||
|
@ -28,16 +28,17 @@ class StatusReporter():
|
|||
# TODO: Make import_status is an int?
|
||||
|
||||
logging.debug("Reporting import failure to Airtime REST API...")
|
||||
audio_metadata = dict()
|
||||
audio_metadata["import_status"] = import_status
|
||||
audio_metadata["comment"] = reason # hack attack
|
||||
put_payload = json.dumps(audio_metadata)
|
||||
logging.debug("sending http put with payload: " + put_payload)
|
||||
r = requests.put(callback_url, data=put_payload,
|
||||
auth=requests.auth.httpbasicauth(api_key, ''),
|
||||
timeout=statusreporter._http_request_timeout)
|
||||
logging.debug("http request returned status: " + str(r.status_code))
|
||||
auth=requests.auth.HTTPBasicAuth(api_key, ''),
|
||||
timeout=StatusReporter._HTTP_REQUEST_TIMEOUT)
|
||||
logging.debug("HTTP request returned status: " + str(r.status_code))
|
||||
logging.debug(r.text) # log the response body
|
||||
|
||||
#todo: queue up failed requests and try them again later.
|
||||
#TODO: queue up failed requests and try them again later.
|
||||
r.raise_for_status() # raise an exception if there was an http error code returned
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue