From afef19fae30c7a958745cf492a9630e411cf1712 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 30 May 2024 20:26:53 +0300 Subject: [PATCH] cache-fix-8 --- services/cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/cache.py b/services/cache.py index eb987607..83c07a3d 100644 --- a/services/cache.py +++ b/services/cache.py @@ -64,7 +64,7 @@ async def get_cached_author(author_id: int, get_with_stat): if isinstance(cached_result, str): return json.loads(cached_result) elif get_with_stat: - async with local_session() as session: + with local_session() as session: author_query = select(Author).filter(Author.id == author_id) [author] = get_with_stat(session.execute(author_query)) if author: @@ -98,7 +98,7 @@ async def get_cached_topic_authors(topic_id: int, topic_authors_query): if isinstance(cached, str): authors_ids = json.loads(cached) else: - async with local_session() as session: + with local_session() as session: authors_ids = [aid for (aid,) in session.execute(topic_authors_query)] await redis.execute("SET", rkey, json.dumps(authors_ids)) authors = await get_cached_authors_by_ids(authors_ids)