send batches of at most 10 heartbeats to api
This commit is contained in:
parent
8809c55765
commit
b488cd537c
3 changed files with 12 additions and 9 deletions
|
@ -66,8 +66,7 @@ def execute(argv=None):
|
|||
retval = send_heartbeats(heartbeats, args, configs)
|
||||
if retval == SUCCESS:
|
||||
queue = Queue(args, configs)
|
||||
offline_heartbeats = queue.pop_many(args.sync_offline_activity)
|
||||
if len(offline_heartbeats) > 0:
|
||||
for offline_heartbeats in queue.pop_many(args.sync_offline_activity):
|
||||
retval = send_heartbeats(offline_heartbeats, args, configs)
|
||||
|
||||
return retval
|
||||
|
|
|
@ -115,8 +115,12 @@ class Queue(object):
|
|||
break
|
||||
heartbeats.append(heartbeat)
|
||||
count += 1
|
||||
if count % 10 == 0:
|
||||
yield heartbeats
|
||||
heartbeats = []
|
||||
|
||||
return heartbeats
|
||||
if heartbeats:
|
||||
yield heartbeats
|
||||
|
||||
def _get_db_file(self):
|
||||
home = '~'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue