def push_all_dumps(): from . import getapi api = getapi() dump_lib.settings = settings with dump_lib.dumps_lock: for dump_id in dump_lib.list_all_dumps_ids(): dump = dump_lib.load_dump(dump_id, True) api.errordump_store(Config.TOMATO_MODULE_WEB, dump, store_key=settings.get_dumpmanager_api_key()) dump_lib.remove_dump(dump_id)
def dump_pusher(): # there must be one thread running this. # this thread is started in init() while auto_push: try: with dump_lib.dumps_lock: if len(dump_lib.list_all_dumps_ids()) > 0: # get dump_id with smallest timestamp dump_id = sorted(dump_lib.dumps.iteritems(), key=lambda d: d[1]['timestamp'])[0][0] # push to backend_debug get_backend_debug_proxy().dump_push_from_backend( settings.get_tomato_module_name(), dump_lib.load_dump(dump_id, load_data=True)) # remove from list dump_lib.remove_dump(dump_id) else: must_autopush.clear() except: must_autopush.clear() # wait for next round if an error occurred. time.sleep(5) # avoid flooding: only one dump per 5 seconds via push! must_autopush.wait()