From 75dd4120ec3bd67725b4e3b97ee4b2e8391f5a86 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 30 May 2024 20:20:02 +0300 Subject: [PATCH] cache-fix-5 --- services/cache.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/cache.py b/services/cache.py index 0fe53caa..3ae84838 100644 --- a/services/cache.py +++ b/services/cache.py @@ -195,13 +195,14 @@ async def get_cached_follower_topics(author_id: int): if cached and isinstance(cached, str): topics_ids = json.loads(cached) else: - topics_ids = ( + topics = ( local_session() - .query(Topic.id) + .query(Topic) .select_from(join(Topic, TopicFollower, Topic.id == TopicFollower.topic)) .where(TopicFollower.follower == author_id) .all() ) + topics_ids = [topic.id for topic in topics] await redis.execute("SET", rkey, json.dumps(topics_ids)) topics = await get_cached_topics_by_ids(topics_ids)