diff --git a/resolvers/author.py b/resolvers/author.py index 0a2e68f4..f4a052c9 100644 --- a/resolvers/author.py +++ b/resolvers/author.py @@ -45,6 +45,7 @@ async def get_author(_, _info, slug='', author_id=None): try: if slug: author_id = local_session().query(Author.id).filter(Author.slug == slug).scalar() + logger.debug(f'found @{slug} with id {author_id}') if author_id: cache_key = f'author:{author_id}' cache = await redis.execute('GET', cache_key) @@ -58,6 +59,11 @@ async def get_author(_, _info, slug='', author_id=None): if result: [author] = result author_dict = author.dict() + else: + logger.warn('author was not cached!') + author_query = select(Author).filter(Author.id == author_id) + author = get_with_stat(author_query) + author_dict = author.dict() logger.debug(f'author to be stored: {author_dict}') if author: await set_author_cache(author_dict)