From 60c7ab5fe4fd7d50ef964ff277318e65cacf20d7 Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 23 Feb 2024 02:53:19 +0300 Subject: [PATCH] separate-getter-follows --- services/follows.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/follows.py b/services/follows.py index a0ec1995..9860828f 100644 --- a/services/follows.py +++ b/services/follows.py @@ -5,7 +5,7 @@ import json from orm.author import Author, AuthorFollower from orm.topic import Topic, TopicFollower -from resolvers.stat import get_with_stat +from resolvers.stat import get_authors_with_stat, get_topics_with_stat from services.rediscache import redis @@ -78,7 +78,7 @@ async def update_follows_for_user( async def handle_author_follower_change(connection, author_id, follower_id, is_insert): q = select(Author).filter(Author.id == author_id) - authors = get_with_stat(q, Author, AuthorFollower) + authors = get_authors_with_stat(q) author = authors[0] async with connection.begin() as conn: follower = await conn.execute( @@ -103,7 +103,7 @@ async def handle_author_follower_change(connection, author_id, follower_id, is_i async def handle_topic_follower_change(connection, topic_id, follower_id, is_insert): q = select(Topic).filter(Topic.id == topic_id) - topics = get_with_stat(q, Author, TopicFollower) + topics = get_topics_with_stat(q) topic = topics[0] async with connection.begin() as conn: