wip: add async execution for http task/downloads

This commit is contained in:
Yannik Schmidt
2025-01-13 23:05:11 +01:00
parent df3ea69efb
commit 311483df19

View File

@@ -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):