following-cache-anyway-found

This commit is contained in:
2024-05-05 20:16:45 +03:00
parent cfe9ac1005
commit 3ab42ecb72
4 changed files with 14 additions and 16 deletions

View File

@@ -51,10 +51,7 @@ async def follow(_, info, what, slug):
follows = []
follows_str = await redis.execute("GET", f"author:{follower_id}:follows-{entity}s")
if isinstance(follows_str, str):
follows = json.loads(follows_str)
if not follows:
return {"error": "cant find following cache"}
follows = json.loads(follows_str) or []
if what == "AUTHOR":
follower_id = int(follower_id)
@@ -105,7 +102,7 @@ async def unfollow(_, info, what, slug):
follows = []
follows_str = await redis.execute("GET", f"author:{follower_id}:follows-{entity}s")
if isinstance(follows_str, str):
follows = json.loads(follows_str)
follows = json.loads(follows_str) or []
if what == "AUTHOR":
error = author_unfollow(follower_id, slug)