From 8eaeaf71f9ae9cb4240f8e15df1627e72a89d574 Mon Sep 17 00:00:00 2001 From: Albert Santoni <albert.santoni@sourcefabric.org> Date: Wed, 12 Nov 2014 17:01:59 -0500 Subject: [PATCH] airtime_analyzer status_reporter shutdown fix --- .../airtime_analyzer/airtime_analyzer/status_reporter.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py b/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py index ebf9a12d5..63ddc704a 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py @@ -85,6 +85,7 @@ def process_http_requests(ipc_queue, http_retry_queue_path): # while the web server is down or unreachable. with open(http_retry_queue_path, 'wb') as pickle_file: pickle.dump(retry_queue, pickle_file) + return except Exception as e: # Terrible top-level exception handler to prevent the thread from dying, just in case. if shutdown: return @@ -98,13 +99,13 @@ def send_http_request(picklable_request, retry_queue): if not isinstance(picklable_request, PicklableHttpRequest): raise TypeError("picklable_request must be a PicklableHttpRequest. Was of type " + type(picklable_request).__name__) try: - t = threading.Timer(60, alert_hung_request) + #t = threading.Timer(60, alert_hung_request) t.start() bare_request = picklable_request.create_request() s = requests.Session() prepared_request = s.prepare_request(bare_request) - r = s.send(prepared_request, timeout=StatusReporter._HTTP_REQUEST_TIMEOUT) - t.cancel() # Watchdog no longer needed. + #r = s.send(prepared_request, timeout=StatusReporter._HTTP_REQUEST_TIMEOUT) + #t.cancel() # Watchdog no longer needed. r.raise_for_status() # Raise an exception if there was an http error code returned logging.info("HTTP request sent successfully.") except requests.exceptions.HTTPError as e: