This commit is contained in:
parent
abc5381adb
commit
2e2dc80718
|
@ -184,13 +184,14 @@ async def get_cached_follower_topics(author_id: int):
|
||||||
if cached and isinstance(cached, str):
|
if cached and isinstance(cached, str):
|
||||||
topics_ids = json.loads(cached)
|
topics_ids = json.loads(cached)
|
||||||
else:
|
else:
|
||||||
|
with local_session() as session:
|
||||||
topics = (
|
topics = (
|
||||||
local_session()
|
session.query(Topic)
|
||||||
.query(Topic)
|
|
||||||
.select_from(join(Topic, TopicFollower, Topic.id == TopicFollower.topic))
|
.select_from(join(Topic, TopicFollower, Topic.id == TopicFollower.topic))
|
||||||
.where(TopicFollower.follower == author_id)
|
.where(TopicFollower.follower == author_id)
|
||||||
.all()
|
.all()
|
||||||
)
|
)
|
||||||
|
|
||||||
topics_ids = [topic.id for topic in topics]
|
topics_ids = [topic.id for topic in topics]
|
||||||
|
|
||||||
await redis.execute("SET", rkey, json.dumps(topics_ids))
|
await redis.execute("SET", rkey, json.dumps(topics_ids))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user