This commit is contained in:
@@ -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 = (
|
||||
|
@@ -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(
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user