From 311483df19cbe4803ef24da23e9fe395c95672b7 Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Mon, 13 Jan 2025 23:05:11 +0100 Subject: [PATCH] wip: add async execution for http task/downloads --- statekeeper.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/statekeeper.py b/statekeeper.py index 1f53f2f..04fb35d 100644 --- a/statekeeper.py +++ b/statekeeper.py @@ -1,14 +1,19 @@ import requests import os +import threading def add_to_download_queue(url, path): '''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): '''Add a callback to background execution queue''' - print("Executing tasks", task) - task() + #print("Executing tasks", task) + thread = threading.Thread(target=task) + thread.start() + #task() def _download(url, path):