diff --git a/tubearchivist/home/tasks.py b/tubearchivist/home/tasks.py index fa8562e..7346304 100644 --- a/tubearchivist/home/tasks.py +++ b/tubearchivist/home/tasks.py @@ -138,7 +138,9 @@ def run_restore_backup(): def kill_dl(task_id): """kill download worker task by ID""" - app.control.revoke(task_id, terminate=True) + if task_id: + app.control.revoke(task_id, terminate=True) + _ = RedisArchivist().del_message("dl_queue_id") RedisQueue("dl_queue").clear() diff --git a/tubearchivist/home/views.py b/tubearchivist/home/views.py index eef969f..c05545b 100644 --- a/tubearchivist/home/views.py +++ b/tubearchivist/home/views.py @@ -588,7 +588,10 @@ class PostData: RedisQueue("dl_queue").clear() elif to_execute == "kill": task_id = RedisArchivist().get_message("dl_queue_id") - print("brutally killing " + task_id) + if not task_id["status"]: + task_id = False + else: + print("brutally killing " + task_id) kill_dl(task_id) return {"success": True}