Move refresher thread launcher into a function.

This commit is contained in:
voussoir 2020-03-28 16:42:54 -07:00
parent d0bfbaadfe
commit 9fe7057021

View file

@ -271,15 +271,17 @@ def post_start_download():
####################################################################################################
####################################################################################################
def refresher_thread():
def refresher_thread(rate):
while True:
time.sleep(60 * 60 * 6)
time.sleep(rate)
print('Starting refresh job.')
thread_kwargs = {'force': False, 'skip_failures': True}
refresh_job = threading.Thread(target=ycdldb.refresh_all_channels, kwargs=thread_kwargs, daemon=True)
refresh_job.start()
refresher = threading.Thread(target=refresher_thread, daemon=True)
def start_refresher_thread(rate):
print(f'Starting refresher thread, once per {rate} seconds.')
refresher = threading.Thread(target=refresher_thread, args=[rate], daemon=True)
refresher.start()
if __name__ == '__main__':