This commit is contained in:
@@ -28,7 +28,7 @@ async def cache_topic(topic: dict):
|
||||
|
||||
async def cache_author(author: dict):
|
||||
author_id = author.get("id")
|
||||
user_id = author.get("user")
|
||||
user_id = author.get("user", "").strip()
|
||||
payload = json.dumps(author, cls=CustomJSONEncoder)
|
||||
await redis.execute("SET", f"author:user:{user_id}", payload)
|
||||
await redis.execute("SET", f"author:id:{author_id}", payload)
|
||||
@@ -76,7 +76,7 @@ async def get_cached_author(author_id: int, get_with_stat):
|
||||
|
||||
|
||||
async def get_cached_author_by_user_id(user_id: str, get_with_stat) -> dict:
|
||||
author_str = await redis.execute("GET", f"author:user:{user_id}")
|
||||
author_str = await redis.execute("GET", f"author:user:{user_id.strip()}")
|
||||
author_dict = None
|
||||
if not author_str:
|
||||
author_query = select(Author).filter(Author.user == user_id)
|
||||
|
Reference in New Issue
Block a user