From 4c126fd859186d3c98ca486663f1a01663826274 Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 14 Aug 2024 16:30:52 +0300 Subject: [PATCH] cache-author-fiz --- cache/cache.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cache/cache.py b/cache/cache.py index 08783f65..ab70d84e 100644 --- a/cache/cache.py +++ b/cache/cache.py @@ -72,8 +72,9 @@ async def get_cached_author(author_id: int, get_with_stat): return json.loads(result) # Load from database if not found in cache q = select(Author).where(Author.id == author_id) - author = get_with_stat(q) - if author: + authors = get_with_stat(q) + if authors: + author = authors[0] await cache_author(author.dict()) return author.dict() return None