stats-follows
All checks were successful
Deploy to core / deploy (push) Successful in 3m20s

This commit is contained in:
2024-02-21 19:48:33 +03:00
parent 1eac614e35
commit 784f790b83
3 changed files with 77 additions and 41 deletions

View File

@@ -103,14 +103,18 @@ async def handle_author_follower_change(connection, author_id, follower_id, is_i
).first()
if follower and author:
await update_follows_for_user(
connection, follower.user, 'author', {
"id": author.id,
"name": author.name,
"slug": author.slug,
"pic": author.pic,
"bio": author.bio,
"stat": author.stat
}, is_insert
connection,
follower.user,
'author',
{
'id': author.id,
'name': author.name,
'slug': author.slug,
'pic': author.pic,
'bio': author.bio,
'stat': author.stat,
},
is_insert,
)
@@ -132,17 +136,23 @@ async def handle_topic_follower_change(connection, topic_id, follower_id, is_ins
).first()
if follower and topic:
await update_follows_for_user(
connection, follower.user, 'topic', {
"id": topic.id,
"title": topic.title,
"slug": topic.slug,
"body": topic.body,
"stat": topic.stat
}, is_insert
connection,
follower.user,
'topic',
{
'id': topic.id,
'title': topic.title,
'slug': topic.slug,
'body': topic.body,
'stat': topic.stat,
},
is_insert,
)
BATCH_SIZE = 33
class FollowsCached:
lock = asyncio.Lock()
@@ -175,7 +185,7 @@ class FollowsCached:
'slug': author.slug,
'pic': author.pic,
'bio': author.bio,
'stat': author.stat
'stat': author.stat,
}
),
)