profiling-db
Some checks failed
Deploy to core / deploy (push) Failing after 2m5s

This commit is contained in:
2024-02-21 17:55:54 +03:00
parent e69046a1f8
commit be9f62eb76
5 changed files with 56 additions and 28 deletions

View File

@@ -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

View File

@@ -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