This commit is contained in:
@@ -193,7 +193,7 @@ async def get_author(_, _info, slug="", author_id=None):
|
||||
|
||||
async def get_author_by_user_id(user_id: str):
|
||||
redis_key = f"user:{user_id}:author"
|
||||
res = await redis.execute('GET', redis_key)
|
||||
res = await redis.execute("GET", redis_key)
|
||||
if isinstance(res, str):
|
||||
author = json.loads(res)
|
||||
if author.get("id"):
|
||||
@@ -204,7 +204,7 @@ async def get_author_by_user_id(user_id: str):
|
||||
q = select(Author).filter(Author.user == user_id)
|
||||
author = await load_author_with_stats(q)
|
||||
if author:
|
||||
await redis.execute('set', redis_key, json.dumps(author.dict()))
|
||||
await redis.execute("set", redis_key, json.dumps(author.dict()))
|
||||
return author
|
||||
|
||||
|
||||
|
@@ -132,14 +132,14 @@ def query_follows(user_id: str):
|
||||
async def get_follows_by_user_id(user_id: str):
|
||||
if user_id:
|
||||
redis_key = f"user:{user_id}:follows"
|
||||
res = await redis.execute('GET', redis_key)
|
||||
res = await redis.execute("GET", redis_key)
|
||||
if isinstance(res, str):
|
||||
follows = json.loads(res)
|
||||
return follows
|
||||
|
||||
logger.debug(f"getting follows for {user_id}")
|
||||
follows = query_follows(user_id)
|
||||
await redis.execute('SET', redis_key, json.dumps(follows))
|
||||
await redis.execute("SET", redis_key, json.dumps(follows))
|
||||
|
||||
return follows
|
||||
|
||||
|
Reference in New Issue
Block a user