fix: use worker_tasks list instead of non-existent worker_task attribute

This commit is contained in:
2026-03-14 09:33:32 +01:00
parent 0ec120e08f
commit 94720f2d61
2 changed files with 5 additions and 4 deletions

View File

@@ -834,9 +834,9 @@ async def add_series(
# Step F: Scan missing episodes immediately if background loader is not running
# Uses existing SerieScanner and AnimeService sync to avoid duplicates
try:
loader_running = (
background_loader.worker_task is not None
and not background_loader.worker_task.done()
loader_running = bool(
background_loader.worker_tasks
and any(not t.done() for t in background_loader.worker_tasks)
)
if (
not loader_running

View File

@@ -36,6 +36,7 @@ def mock_anime_service():
"""Mock AnimeService."""
service = AsyncMock()
service.sync_episodes_to_db = AsyncMock()
service.sync_single_series_after_scan = AsyncMock()
return service
@@ -600,7 +601,7 @@ class TestScanMissingEpisodes:
await background_loader_service._scan_missing_episodes(task, mock_db)
assert task.progress["episodes"] is True
background_loader_service.anime_service.sync_episodes_to_db.assert_called_once_with("test")
background_loader_service.anime_service.sync_single_series_after_scan.assert_called_once_with("test")
@pytest.mark.asyncio
async def test_scan_missing_episodes_no_scanner(self, background_loader_service):