refactor: encapsulate task clearing behind TaskManager.clear_all()

This commit is contained in:
Daddy Raegen
2026-03-06 20:33:21 -05:00
parent d744e634a8
commit a8ecf3f31d
2 changed files with 6 additions and 2 deletions
+1 -2
View File
@@ -1616,8 +1616,7 @@ async def clear_all_tasks():
task_manager = get_task_manager()
progress_manager = get_progress_manager()
task_manager._active_downloads.clear()
task_manager._active_generations.clear()
task_manager.clear_all()
with progress_manager._lock:
progress_manager._progress.clear()
+5
View File
@@ -76,6 +76,11 @@ class TaskManager:
"""Cancel/dismiss a download task (removes it from active list)."""
return self._active_downloads.pop(model_name, None) is not None
def clear_all(self) -> None:
"""Clear all download and generation tasks."""
self._active_downloads.clear()
self._active_generations.clear()
def is_download_active(self, model_name: str) -> bool:
"""Check if a download is active."""
return model_name in self._active_downloads