fmt
All checks were successful
Deploy on push / deploy (push) Successful in 24s

This commit is contained in:
2024-05-07 00:06:31 +03:00
parent e61db5d6e5
commit e0a5c654d8
9 changed files with 33 additions and 40 deletions

View File

@@ -1,9 +1,9 @@
import json
from orm.topic import TopicFollower
from services.db import local_session
from services.encoders import CustomJSONEncoder
from services.rediscache import redis
from services.db import local_session
DEFAULT_FOLLOWS = {
"topics": [],
@@ -64,10 +64,9 @@ async def cache_author(author: dict):
# author not found in the list, so add the new author with the updated stat field
followed_author_followers.append(author)
await redis.execute(
"SET", f"author:{author_id}:followers", json.dumps(
followed_author_followers,
cls=CustomJSONEncoder
)
"SET",
f"author:{author_id}:followers",
json.dumps(followed_author_followers, cls=CustomJSONEncoder),
)
@@ -138,7 +137,6 @@ async def cache_follow_author_change(follower: dict, author: dict, is_insert=Tru
return followers
async def cache_topic(topic_dict: dict):
# update stat all field for followers' caches in <topics> list
followers = (

View File

@@ -30,8 +30,12 @@ async def handle_author_follower_change(
[follower] = get_with_stat(follower_query)
if follower and author:
await cache_author(author.dict())
await cache_follows(follower.dict(), "author", author.dict(), is_insert) # cache_author(follower_dict) inside
await cache_follow_author_change(follower.dict(), author.dict(), is_insert) # cache_author(follower_dict) inside
await cache_follows(
follower.dict(), "author", author.dict(), is_insert
) # cache_author(follower_dict) inside
await cache_follow_author_change(
follower.dict(), author.dict(), is_insert
) # cache_author(follower_dict) inside
async def handle_topic_follower_change(

View File

@@ -7,12 +7,7 @@ from typing import Dict
# ga
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import (
DateRange,
Dimension,
Metric,
RunReportRequest,
)
from google.analytics.data_v1beta.types import DateRange, Dimension, Metric, RunReportRequest
from orm.author import Author
from orm.shout import Shout, ShoutAuthor, ShoutTopic