save heartbeat to sqlite db when no response from api

This commit is contained in:
Alan Hamlett 2014-12-22 00:52:41 -06:00
parent c5e8c1bb31
commit 1feca4871f

View file

@ -312,7 +312,7 @@ def send_action(project=None, branch=None, stats={}, key=None, targetFile=None,
if log.isEnabledFor(logging.DEBUG): if log.isEnabledFor(logging.DEBUG):
exception_data['traceback'] = traceback.format_exc() exception_data['traceback'] = traceback.format_exc()
if offline: if offline:
if response is not None and response.getcode() != 400: if response is None or response.getcode() != 400:
queue = Queue() queue = Queue()
queue.push(data, json.dumps(stats), plugin) queue.push(data, json.dumps(stats), plugin)
if log.isEnabledFor(logging.DEBUG): if log.isEnabledFor(logging.DEBUG):
@ -330,7 +330,7 @@ def send_action(project=None, branch=None, stats={}, key=None, targetFile=None,
if log.isEnabledFor(logging.DEBUG): if log.isEnabledFor(logging.DEBUG):
exception_data['traceback'] = traceback.format_exc() exception_data['traceback'] = traceback.format_exc()
if offline: if offline:
if response is not None and response.getcode() != 400: if response is None or response.getcode() != 400:
queue = Queue() queue = Queue()
queue.push(data, json.dumps(stats), plugin) queue.push(data, json.dumps(stats), plugin)
if 'unknown url type: https' in u(sys.exc_info()[1]): if 'unknown url type: https' in u(sys.exc_info()[1]):
@ -352,7 +352,7 @@ def send_action(project=None, branch=None, stats={}, key=None, targetFile=None,
response_code = response.getcode() if response is not None else None response_code = response.getcode() if response is not None else None
response_content = response.read() if response is not None else None response_content = response.read() if response is not None else None
if offline: if offline:
if response is not None and response.getcode() != 400: if response is None or response.getcode() != 400:
queue = Queue() queue = Queue()
queue.push(data, json.dumps(stats), plugin) queue.push(data, json.dumps(stats), plugin)
if log.isEnabledFor(logging.DEBUG): if log.isEnabledFor(logging.DEBUG):