mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 20:00:15 +00:00
fix killing task with missing task id
This commit is contained in:
parent
e202265a5f
commit
567e9d473b
@ -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()
|
||||
|
||||
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user