Fix double SeriesApp initialization on startup
- Moved sync_series_from_data_files() before DownloadService init - Ensures series are in DB before main SeriesApp creation - Eliminates redundant SeriesApp instantiation during startup - Updated README to clarify initialization sequence
This commit is contained in:
@@ -159,11 +159,12 @@ On first startup, the application performs a one-time sync of series from data f
|
||||
|
||||
1. FastAPI lifespan starts
|
||||
2. Database is initialized
|
||||
3. `sync_series_from_data_files()` reads all data files from the anime directory
|
||||
3. `sync_series_from_data_files()` reads all data files from the anime directory (creates temporary SeriesApp)
|
||||
4. Series metadata is synced to the database
|
||||
5. `SeriesApp` loads series from database (not from files)
|
||||
5. DownloadService initializes (triggers main `SeriesApp` creation)
|
||||
6. `SeriesApp` loads series from database via service layer (not from files)
|
||||
|
||||
On subsequent startups, `SeriesApp` initializes with an empty series list (`skip_load=True`). Series are loaded from the database by the service layer as needed, avoiding redundant file system scans.
|
||||
On subsequent startups, the same flow applies but the sync finds no new series. `SeriesApp` always initializes with an empty series list (`skip_load=True`) and loads data from the database on demand, avoiding redundant file system scans.
|
||||
|
||||
### Adding New Series
|
||||
|
||||
|
||||
Reference in New Issue
Block a user