Add exists check

This commit is contained in:
2022-08-11 22:02:05 +03:00
parent a9c57e3c7c
commit a32c3d2909

View File

@@ -60,6 +60,11 @@ async def check_books(ctx: dict, *args, **kwargs) -> None: # NOSONAR
async def cache_file(book: Book, file_type: str) -> Optional[CachedFile]: async def cache_file(book: Book, file_type: str) -> Optional[CachedFile]:
if await CachedFile.objects.filter(
object_id=book.id, object_type=file_type
).exists():
return
data = await download(book.source.id, book.remote_id, file_type) data = await download(book.source.id, book.remote_id, file_type)
if data is None: if data is None: