From 69598b2264aa798153472c0c0ff99411c284fdec Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Sun, 14 Aug 2022 22:29:21 +0300 Subject: [PATCH] Fix timeouts --- src/app/services/cache_updater.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/services/cache_updater.py b/src/app/services/cache_updater.py index 6ecb848..7219df1 100644 --- a/src/app/services/cache_updater.py +++ b/src/app/services/cache_updater.py @@ -65,10 +65,15 @@ async def cache_file(book: Book, file_type: str) -> Optional[CachedFile]: ).exists(): return - data = await download(book.source.id, book.remote_id, file_type) + retry_exc = Retry(defer=60) + + try: + data = await download(book.source.id, book.remote_id, file_type) + except httpx.TimeoutException: + raise retry_exc if data is None: - raise Retry(defer=60) + raise retry_exc response, client, filename = data caption = get_caption(book)