From 20df71412dc6f9ed5b8b0180bf84e6fda9f93e26 Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Thu, 15 Dec 2022 17:31:12 +0100 Subject: [PATCH] Add caching files if cache not valid --- src/app/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/views.py b/src/app/views.py index 6825af6..5731849 100644 --- a/src/app/views.py +++ b/src/app/views.py @@ -68,6 +68,12 @@ async def download_cached_file(request: Request, object_id: int, object_type: st if data is None: await CachedFileDB.objects.filter(id=cached_file.id).delete() + + arq_pool: ArqRedis = request.app.state.arq_pool + await arq_pool.enqueue_job( + "cache_file_by_book_id", object_id, object_type, by_request=False + ) + raise HTTPException(status_code=status.HTTP_204_NO_CONTENT) response, client = data