fix: prevent folder scan during NFO processing on startup
- Modified SeriesManagerService to create SerieList with skip_load=True - Changed scan_and_process_nfo() to load series from database instead of filesystem - Fixed database transaction issue by creating separate session per task - Verified scans only run once during initial setup, not on normal startup
This commit is contained in:
@@ -150,7 +150,7 @@ class TestMediaScanStartup:
|
||||
async def test_check_incomplete_series_integration(self):
|
||||
"""Test the _check_incomplete_series_on_startup function behavior."""
|
||||
from src.server.database.models import AnimeSeries
|
||||
|
||||
|
||||
# Mock database session
|
||||
mock_db = AsyncMock()
|
||||
|
||||
@@ -185,7 +185,7 @@ class TestMediaScanStartup:
|
||||
|
||||
# Import and call the function
|
||||
from src.server.fastapi_app import _check_incomplete_series_on_startup
|
||||
|
||||
|
||||
# Mock get_db_session (it's imported inside the function)
|
||||
with patch('src.server.database.connection.get_db_session') as mock_get_db:
|
||||
mock_get_db.return_value.__aenter__.return_value = mock_db
|
||||
@@ -277,7 +277,7 @@ class TestMediaScanStartup:
|
||||
mock_get_db.side_effect = Exception("Database connection error")
|
||||
|
||||
from src.server.fastapi_app import _check_incomplete_series_on_startup
|
||||
|
||||
|
||||
# Should not raise exception
|
||||
try:
|
||||
await _check_incomplete_series_on_startup(mock_background_loader)
|
||||
|
||||
Reference in New Issue
Block a user