found-author-fix

This commit is contained in:
Untone 2024-04-09 13:30:02 +03:00
parent 5bbfd2249f
commit e587ed05df

View File

@ -56,6 +56,8 @@ async def get_author(_, _info, slug='', author_id=0):
# lookup for cached author # lookup for cached author
author_query = select(Author).filter(or_(Author.slug == slug, Author.id == author_id)) author_query = select(Author).filter(or_(Author.slug == slug, Author.id == author_id))
found_author = local_session().execute(author_query).first() found_author = local_session().execute(author_query).first()
logger.debug(found_author)
if found_author:
logger.debug(f'found author id: {found_author.id}') logger.debug(f'found author id: {found_author.id}')
author_id = found_author.id if not found_author.id else author_id author_id = found_author.id if not found_author.id else author_id
cached_result = await redis.execute('GET', f'author:{author_id}') cached_result = await redis.execute('GET', f'author:{author_id}')