fix killing task with missing task id

This commit is contained in:
simon 2021-10-11 15:26:31 +07:00
parent e202265a5f
commit 567e9d473b
2 changed files with 7 additions and 2 deletions

View File

@ -138,7 +138,9 @@ def run_restore_backup():
def kill_dl(task_id):
"""kill download worker task by ID"""
if task_id:
app.control.revoke(task_id, terminate=True)
_ = RedisArchivist().del_message("dl_queue_id")
RedisQueue("dl_queue").clear()

View File

@ -588,6 +588,9 @@ class PostData:
RedisQueue("dl_queue").clear()
elif to_execute == "kill":
task_id = RedisArchivist().get_message("dl_queue_id")
if not task_id["status"]:
task_id = False
else:
print("brutally killing " + task_id)
kill_dl(task_id)