redis-fix

This commit is contained in:
Untone 2024-03-11 12:07:19 +03:00
parent 5f7087b0df
commit e23c49b6c6

View File

@ -59,7 +59,7 @@ async def update_follows_for_author(
follower: Author, entity_type: str, entity: dict, is_insert: bool
):
redis_key = f'author:{follower.id}:follows-{entity_type}s'
follows_str = await redis.get(redis_key)
follows_str = await redis.execute('GET', redis_key)
follows = json.loads(follows_str) if follows_str else []
if is_insert:
follows.append(entity)
@ -77,7 +77,7 @@ async def update_followers_for_author(
follower: Author, author: Author, is_insert: bool
):
redis_key = f'author:{author.id}:followers'
followers_str = await redis.get(redis_key)
followers_str = await redis.execute('GET', redis_key)
followers = json.loads(followers_str) if followers_str else []
if is_insert:
followers.append(follower)