Make sure any leftover heartbeats not accepted by API are saved
This commit is contained in:
parent
aa58524f66
commit
9ffb677f9d
10 changed files with 254 additions and 275 deletions
|
@ -161,7 +161,7 @@ def _process_server_results(heartbeats, code, content, results, args, configs):
|
|||
|
||||
for i in range(len(results)):
|
||||
if len(heartbeats) <= i:
|
||||
log.debug('Results from server do not match heartbeats sent.')
|
||||
log.warn('Results from api not matching heartbeats sent.')
|
||||
break
|
||||
|
||||
try:
|
||||
|
@ -177,6 +177,12 @@ def _process_server_results(heartbeats, code, content, results, args, configs):
|
|||
if not _success(c):
|
||||
_handle_unsent_heartbeats([heartbeats[i]], c, text, args, configs)
|
||||
|
||||
leftover = len(heartbeats) - len(results)
|
||||
if leftover > 0:
|
||||
log.warn('Missing {0} results from api.'.format(leftover))
|
||||
start = len(heartbeats) - leftover
|
||||
_handle_unsent_heartbeats(heartbeats[start:], code, content, args, configs)
|
||||
|
||||
|
||||
def _handle_unsent_heartbeats(heartbeats, code, content, args, configs):
|
||||
if args.offline:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue