From 8dcd985c67b822a5b665f086c39de477dc29d68c Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 30 May 2024 20:49:37 +0300 Subject: [PATCH] cache-fix-10 --- services/cache.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/cache.py b/services/cache.py index f2a6f70d..9bd21cf5 100644 --- a/services/cache.py +++ b/services/cache.py @@ -175,8 +175,9 @@ async def get_cached_follower_authors(author_id: int): .where(AuthorFollower.follower == author_id) ) with local_session() as session: - [authors_ids] = session.execute(authors_query) - await redis.execute("SET", rkey, json.dumps([int(aid) for aid in authors_ids])) + result = session.execute(authors_query) + authors_ids = [a[0] for a in result] + await redis.execute("SET", rkey, json.dumps(authors_ids)) elif isinstance(cached, str): authors_ids = json.loads(cached) return await get_cached_authors_by_ids(authors_ids)