Fix timeouts

This commit is contained in:
2022-08-14 22:29:21 +03:00
parent a32c3d2909
commit 69598b2264

View File

@@ -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)