refactor: improve error handling in anime refresh loop

- Reorganized the try-except structure in the _refresh_loop method for better readability and clarity.
- Ensured that the error handling for asyncio.CancelledError and other exceptions is properly nested within the loop.
This commit is contained in:
g0ldyy
2025-12-10 19:01:16 +01:00
parent 0a1a8f39fe
commit ad42e90b3b
+6 -6
View File
@@ -230,14 +230,14 @@ class AnimeMapper:
return entry[key]
async def _refresh_loop(self, interval: int):
try:
while True:
while True:
try:
await asyncio.sleep(interval)
await self._refresh_from_remote(background=True)
except asyncio.CancelledError:
raise
except Exception as exc:
logger.warning(f"Anime mapping refresh loop encountered an error: {exc}")
except asyncio.CancelledError:
raise
except Exception as exc:
logger.warning(f"Anime mapping refresh loop encountered an error: {exc}")
async def stop(self):
if self._background_task: