get_author_follows-fix
All checks were successful
Deploy on push / deploy (push) Successful in 23s

This commit is contained in:
Untone 2024-03-28 13:37:28 +03:00
parent 65fd4df5ef
commit 7907e5bc4f

View File

@ -173,7 +173,7 @@ async def get_author_follows(_, _info, slug='', user=None, author_id=0):
raise ValueError('One of slug, user, or author_id must be provided') raise ValueError('One of slug, user, or author_id must be provided')
[author] = local_session().execute(author_query) [author] = local_session().execute(author_query)
if isinstance(author, Author): if isinstance(author, Author):
author_id = author.id author_id = author.id.scalar()
rkey = f'author:{author_id}:follows-authors' rkey = f'author:{author_id}:follows-authors'
logger.debug(f'getting {author_id} follows authors') logger.debug(f'getting {author_id} follows authors')
cached = await redis.execute('GET', rkey) cached = await redis.execute('GET', rkey)
@ -186,7 +186,7 @@ async def get_author_follows(_, _info, slug='', user=None, author_id=0):
rkey = f'author:{author_id}:follows-topics' rkey = f'author:{author_id}:follows-topics'
cached = await redis.execute('GET', rkey) cached = await redis.execute('GET', rkey)
if cached: if cached and isinstance(cached, str):
topics = json.loads(cached) topics = json.loads(cached)
if not cached: if not cached:
topics = author_follows_topics(author_id) topics = author_follows_topics(author_id)