refactored-author-on-login-required
All checks were successful
Deploy on push / deploy (push) Successful in 23s

This commit is contained in:
2024-04-19 18:22:07 +03:00
parent 0ca6676474
commit b7d82d9cc5
18 changed files with 316 additions and 346 deletions

View File

@@ -6,12 +6,12 @@ from sqlalchemy import event, select
from orm.author import Author, AuthorFollower
from orm.reaction import Reaction
from orm.shout import Shout, ShoutAuthor
from orm.topic import TopicFollower, Topic
from orm.topic import Topic, TopicFollower
from resolvers.stat import get_with_stat
from services.cache import cache_author, cache_follower, cache_follows
from services.encoders import CustomJSONEncoder
from services.rediscache import redis
from services.logger import root_logger as logger
from services.cache import cache_author, cache_follows, cache_follower
from services.rediscache import redis
DEFAULT_FOLLOWS = {
"topics": [],
@@ -31,8 +31,8 @@ async def handle_author_follower_change(
if follower and author:
await cache_author(author.dict())
await cache_author(follower.dict())
await cache_follows(follower, "author", author.dict(), is_insert)
await cache_follower(follower, author, is_insert)
await cache_follows(follower.dict(), "author", author.dict(), is_insert)
await cache_follower(follower.dict(), author.dict(), is_insert)
async def handle_topic_follower_change(
@@ -48,7 +48,7 @@ async def handle_topic_follower_change(
await redis.execute(
"SET", f"topic:{topic.id}", json.dumps(topic.dict(), cls=CustomJSONEncoder)
)
await cache_follows(follower, "topic", topic.dict(), is_insert)
await cache_follows(follower.dict(), "topic", topic.dict(), is_insert)
# handle_author_follow and handle_topic_follow -> cache_author, cache_follows, cache_followers