Optimize startup: skip series loading on every SeriesApp init
- SeriesApp now passes skip_load=True to SerieList - Prevents redundant data file loading on every startup - Series loaded once during setup via sync_series_from_data_files() - Removed obsolete _init_list_sync() and _init_list() methods - Updated documentation in ARCHITECTURE.md and README.md
This commit is contained in:
@@ -164,11 +164,12 @@ class SeriesApp:
|
||||
self.serie_scanner = SerieScanner(
|
||||
directory_to_search, self.loader
|
||||
)
|
||||
self.list = SerieList(self.directory_to_search)
|
||||
# Skip automatic loading from data files - series will be loaded
|
||||
# from database by the service layer during application setup
|
||||
self.list = SerieList(self.directory_to_search, skip_load=True)
|
||||
self.series_list: List[Any] = []
|
||||
# Synchronous init used during constructor to avoid awaiting
|
||||
# in __init__
|
||||
self._init_list_sync()
|
||||
# Initialize empty list - series loaded later via load_series_from_list()
|
||||
# No need to call _init_list_sync() anymore
|
||||
|
||||
# Initialize NFO service if TMDB API key is configured
|
||||
self.nfo_service: Optional[NFOService] = None
|
||||
@@ -242,26 +243,6 @@ class SeriesApp:
|
||||
len(self.series_list)
|
||||
)
|
||||
|
||||
def _init_list_sync(self) -> None:
|
||||
"""Synchronous initialization helper for constructor."""
|
||||
self.series_list = self.list.GetMissingEpisode()
|
||||
logger.debug(
|
||||
"Loaded %d series with missing episodes",
|
||||
len(self.series_list)
|
||||
)
|
||||
|
||||
async def _init_list(self) -> None:
|
||||
"""Initialize the series list with missing episodes (async)."""
|
||||
loop = asyncio.get_running_loop()
|
||||
self.series_list = await loop.run_in_executor(
|
||||
self.executor,
|
||||
self.list.GetMissingEpisode
|
||||
)
|
||||
logger.debug(
|
||||
"Loaded %d series with missing episodes",
|
||||
len(self.series_list)
|
||||
)
|
||||
|
||||
async def search(self, words: str) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
Search for anime series (async).
|
||||
|
||||
Reference in New Issue
Block a user