mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-26 13:45:16 -07:00
refactor: encapsulate task clearing behind TaskManager.clear_all()
This commit is contained in:
+1
-2
@@ -1616,8 +1616,7 @@ async def clear_all_tasks():
|
|||||||
task_manager = get_task_manager()
|
task_manager = get_task_manager()
|
||||||
progress_manager = get_progress_manager()
|
progress_manager = get_progress_manager()
|
||||||
|
|
||||||
task_manager._active_downloads.clear()
|
task_manager.clear_all()
|
||||||
task_manager._active_generations.clear()
|
|
||||||
|
|
||||||
with progress_manager._lock:
|
with progress_manager._lock:
|
||||||
progress_manager._progress.clear()
|
progress_manager._progress.clear()
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ class TaskManager:
|
|||||||
"""Cancel/dismiss a download task (removes it from active list)."""
|
"""Cancel/dismiss a download task (removes it from active list)."""
|
||||||
return self._active_downloads.pop(model_name, None) is not None
|
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:
|
def is_download_active(self, model_name: str) -> bool:
|
||||||
"""Check if a download is active."""
|
"""Check if a download is active."""
|
||||||
return model_name in self._active_downloads
|
return model_name in self._active_downloads
|
||||||
|
|||||||
Reference in New Issue
Block a user