#NEWLINE# def sync_offline_heartbeats( args , hostname ) : #NEWLINE# #INDENT# 'Sends all heartbeats which were cached in the offline Queue.' #NEWLINE# queue = Queue ( ) #NEWLINE# while True : #NEWLINE# #INDENT# heartbeat = queue . pop ( ) #NEWLINE# if ( heartbeat is None ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# status = send_heartbeat ( project = heartbeat [ 'project' ] , entity = heartbeat [ 'entity' ] , timestamp = heartbeat [ 'time' ] , branch = heartbeat [ 'branch' ] , hostname = hostname , stats = json . loads ( heartbeat [ 'stats' ] ) , key = args . key , is_write = heartbeat [ 'is_write' ] , plugin = heartbeat [ 'plugin' ] , offline = args . offline , hidefilenames = heartbeat . hidefilenames , entity_type = heartbeat [ 'type' ] , proxy = args . proxy , api_url = args . api_url , timeout = args . timeout ) #NEWLINE# if ( status != SUCCESS ) : #NEWLINE# #INDENT# if ( status == AUTH_ERROR ) : #NEWLINE# #INDENT# return AUTH_ERROR #NEWLINE# #UNINDENT# break #NEWLINE# #UNINDENT# #UNINDENT# return SUCCESS