fix: scan episodes synchronously and disable test mode rate limiting
- Always scan missing episodes sync in add_series to avoid race condition - Add db fallback in get_anime when in-memory episodeDict empty - Add with_episodes param to AnimeSeriesService.get_by_key - Disable auth rate limiting and lockout in test mode (ANIWORLD_TESTING=1) - Simplify responsive.robot tests: fix setup, remove fragile width checks
This commit is contained in:
@@ -140,7 +140,11 @@ class AnimeSeriesService:
|
||||
return result.scalar_one_or_none()
|
||||
|
||||
@staticmethod
|
||||
async def get_by_key(db: AsyncSession, key: str) -> Optional[AnimeSeries]:
|
||||
async def get_by_key(
|
||||
db: AsyncSession,
|
||||
key: str,
|
||||
with_episodes: bool = False,
|
||||
) -> Optional[AnimeSeries]:
|
||||
"""Get anime series by provider key.
|
||||
|
||||
This is the PRIMARY lookup method for series identification.
|
||||
@@ -150,6 +154,7 @@ class AnimeSeriesService:
|
||||
Args:
|
||||
db: Database session
|
||||
key: Unique provider key (e.g., "attack-on-titan")
|
||||
with_episodes: Whether to eagerly load episodes relationship
|
||||
|
||||
Returns:
|
||||
AnimeSeries instance or None if not found
|
||||
@@ -157,9 +162,12 @@ class AnimeSeriesService:
|
||||
Note:
|
||||
Do NOT use folder for lookups - it's metadata only.
|
||||
"""
|
||||
result = await db.execute(
|
||||
select(AnimeSeries).where(AnimeSeries.key == key)
|
||||
)
|
||||
query = select(AnimeSeries).where(AnimeSeries.key == key)
|
||||
|
||||
if with_episodes:
|
||||
query = query.options(selectinload(AnimeSeries.episodes))
|
||||
|
||||
result = await db.execute(query)
|
||||
return result.scalar_one_or_none()
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user