From d20647c8258214dbe8b2c1369a64f113b7999b14 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 30 May 2024 17:49:33 +0300 Subject: [PATCH] cache-fix --- services/cache.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/cache.py b/services/cache.py index bc4e8f13..a33bc2c4 100644 --- a/services/cache.py +++ b/services/cache.py @@ -115,10 +115,10 @@ async def get_cached_author_follows_authors(author_id: int): select(Author.id) .select_from(join(Author, AuthorFollower, Author.id == AuthorFollower.author)) .where(AuthorFollower.follower == author_id) - .all() ) - authors = local_session().execute(authors_query) - await redis.execute("SET", rkey, json.dumps([aid for aid in authors])) + with local_session() as session: + authors = session.execute(authors_query) + await redis.execute("SET", rkey, json.dumps([aid for aid in authors])) elif isinstance(cached, str): authors = json.loads(cached) authors_objects = []