don't queue heartbeats when they will never be valid

This commit is contained in:
Alan Hamlett 2014-12-15 11:59:49 -06:00
parent 76b745c44e
commit 01689a2ef5

View file

@ -310,8 +310,9 @@ def send_action(project=None, branch=None, stats=None, 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:
queue = Queue() if response is not None and response.getcode() != 400 and response.getcode() != 401:
queue.push(data, plugin) queue = Queue()
queue.push(data, plugin)
if log.isEnabledFor(logging.DEBUG): if log.isEnabledFor(logging.DEBUG):
log.warn(exception_data) log.warn(exception_data)
if response is not None and response.getcode() in ALWAYS_LOG_CODES: if response is not None and response.getcode() in ALWAYS_LOG_CODES:
@ -327,8 +328,9 @@ def send_action(project=None, branch=None, stats=None, 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:
queue = Queue() if response is not None and response.getcode() != 400 and response.getcode() != 401:
queue.push(data, plugin) queue = Queue()
queue.push(data, plugin)
if 'unknown url type: https' in u(sys.exc_info()[1]): if 'unknown url type: https' in u(sys.exc_info()[1]):
log.error(exception_data) log.error(exception_data)
elif log.isEnabledFor(logging.DEBUG): elif log.isEnabledFor(logging.DEBUG):
@ -348,8 +350,9 @@ def send_action(project=None, branch=None, stats=None, 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:
queue = Queue() if response is not None and response.getcode() != 400 and response.getcode() != 401:
queue.push(data, plugin) queue = Queue()
queue.push(data, plugin)
if log.isEnabledFor(logging.DEBUG): if log.isEnabledFor(logging.DEBUG):
log.warn({ log.warn({
'response_code': response_code, 'response_code': response_code,