async-fix
All checks were successful
deploy / deploy (push) Successful in 49s

This commit is contained in:
2024-04-19 11:22:57 +03:00
parent 63cf0b9fee
commit 12c5d2677d
3 changed files with 9 additions and 8 deletions

View File

@@ -10,33 +10,33 @@ from services.rediscache import redis
logger.setLevel(logging.DEBUG)
def get_all_authors():
async def get_all_authors():
authors = []
redis_key = "user:*"
result = redis.execute("GET", redis_key)
result = await redis.execute("GET", redis_key)
if isinstance(result, str):
authors = json.loads(result)
return authors
def get_author_by_user(user: str):
async def get_author_by_user(user: str):
author = None
redis_key = f"user:{user}"
result = redis.execute("GET", redis_key)
result = await redis.execute("GET", redis_key)
if isinstance(result, str):
author = json.loads(result)
return author
def get_author_followed(author_id: int):
async def get_author_followed(author_id: int):
authors = []
redis_key = f"author:{author_id}:follows-authors"
result = redis.execute("GET", redis_key)
result = await redis.execute("GET", redis_key)
if isinstance(result, str):
authors = json.loads(result)