mirror of
https://github.com/FAUSheppy/homelab_gamevault
synced 2025-12-06 06:51:36 +01:00
wip: add async execution for http task/downloads
This commit is contained in:
@@ -1,14 +1,19 @@
|
|||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
|
import threading
|
||||||
|
|
||||||
def add_to_download_queue(url, path):
|
def add_to_download_queue(url, path):
|
||||||
'''The download is added to the global queue and downloaded eventually'''
|
'''The download is added to the global queue and downloaded eventually'''
|
||||||
_download(url, path)
|
#_download(url, path)
|
||||||
|
thread = threading.Thread(target=_download, args=(url, path))
|
||||||
|
thread.start()
|
||||||
|
|
||||||
def add_to_task_queue(task):
|
def add_to_task_queue(task):
|
||||||
'''Add a callback to background execution queue'''
|
'''Add a callback to background execution queue'''
|
||||||
print("Executing tasks", task)
|
#print("Executing tasks", task)
|
||||||
task()
|
thread = threading.Thread(target=task)
|
||||||
|
thread.start()
|
||||||
|
#task()
|
||||||
|
|
||||||
def _download(url, path):
|
def _download(url, path):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user