This commit is contained in:
parent
6ed144327c
commit
9791ba4b49
|
@ -148,7 +148,7 @@ async def get_cached_author_followers(author_id: int):
|
||||||
|
|
||||||
followers = (
|
followers = (
|
||||||
local_session()
|
local_session()
|
||||||
.query(Author.id)
|
.query(Author)
|
||||||
.join(
|
.join(
|
||||||
AuthorFollower,
|
AuthorFollower,
|
||||||
and_(
|
and_(
|
||||||
|
@ -160,7 +160,7 @@ async def get_cached_author_followers(author_id: int):
|
||||||
.all()
|
.all()
|
||||||
)
|
)
|
||||||
|
|
||||||
await redis.execute("SET", rkey, json.dumps([x[0] for x in followers]))
|
await redis.execute("SET", rkey, json.dumps([a.id for a in followers]))
|
||||||
|
|
||||||
followers_objects = []
|
followers_objects = []
|
||||||
for follower_id in followers:
|
for follower_id in followers:
|
||||||
|
@ -184,7 +184,7 @@ async def get_cached_topic_followers(topic_id: int):
|
||||||
|
|
||||||
followers = (
|
followers = (
|
||||||
local_session()
|
local_session()
|
||||||
.query(Author.id)
|
.query(Author)
|
||||||
.join(
|
.join(
|
||||||
TopicFollower,
|
TopicFollower,
|
||||||
and_(TopicFollower.topic == topic_id, TopicFollower.follower == Author.id),
|
and_(TopicFollower.topic == topic_id, TopicFollower.follower == Author.id),
|
||||||
|
@ -193,7 +193,7 @@ async def get_cached_topic_followers(topic_id: int):
|
||||||
)
|
)
|
||||||
followers_objects = []
|
followers_objects = []
|
||||||
if followers:
|
if followers:
|
||||||
await redis.execute("SET", rkey, json.dumps([x[0] for x in followers]))
|
await redis.execute("SET", rkey, json.dumps([a.id for a in followers]))
|
||||||
|
|
||||||
for follower_id in followers:
|
for follower_id in followers:
|
||||||
follower_str = await redis.execute("GET", f"author:id:{follower_id}")
|
follower_str = await redis.execute("GET", f"author:id:{follower_id}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user