fix: use worker_tasks list instead of non-existent worker_task attribute
This commit is contained in:
@@ -834,9 +834,9 @@ async def add_series(
|
|||||||
# Step F: Scan missing episodes immediately if background loader is not running
|
# Step F: Scan missing episodes immediately if background loader is not running
|
||||||
# Uses existing SerieScanner and AnimeService sync to avoid duplicates
|
# Uses existing SerieScanner and AnimeService sync to avoid duplicates
|
||||||
try:
|
try:
|
||||||
loader_running = (
|
loader_running = bool(
|
||||||
background_loader.worker_task is not None
|
background_loader.worker_tasks
|
||||||
and not background_loader.worker_task.done()
|
and any(not t.done() for t in background_loader.worker_tasks)
|
||||||
)
|
)
|
||||||
if (
|
if (
|
||||||
not loader_running
|
not loader_running
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ def mock_anime_service():
|
|||||||
"""Mock AnimeService."""
|
"""Mock AnimeService."""
|
||||||
service = AsyncMock()
|
service = AsyncMock()
|
||||||
service.sync_episodes_to_db = AsyncMock()
|
service.sync_episodes_to_db = AsyncMock()
|
||||||
|
service.sync_single_series_after_scan = AsyncMock()
|
||||||
return service
|
return service
|
||||||
|
|
||||||
|
|
||||||
@@ -600,7 +601,7 @@ class TestScanMissingEpisodes:
|
|||||||
await background_loader_service._scan_missing_episodes(task, mock_db)
|
await background_loader_service._scan_missing_episodes(task, mock_db)
|
||||||
|
|
||||||
assert task.progress["episodes"] is True
|
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
|
@pytest.mark.asyncio
|
||||||
async def test_scan_missing_episodes_no_scanner(self, background_loader_service):
|
async def test_scan_missing_episodes_no_scanner(self, background_loader_service):
|
||||||
|
|||||||
Reference in New Issue
Block a user