refactored-get-author-3
All checks were successful
Deploy on push / deploy (push) Successful in 23s

This commit is contained in:
2024-03-28 19:08:55 +03:00
parent 8826af02b5
commit 9d8831d7ed
3 changed files with 3 additions and 0 deletions

View File

@@ -71,6 +71,7 @@ async def get_author(_, _info, slug='', author_id=None):
q = select(Author).where(Author.id == author_id)
[author] = await get_authors_with_stat_cached(q)
if author:
logger.debug(f'queried author from db {cache_key} -> {cache}')
author_dict = author.dict()
else:
logger.warn('author was not cached!')

View File

@@ -197,6 +197,7 @@ def get_with_stat(q):
async def get_authors_with_stat_cached(q):
logger.debug(q)
try:
records = []
with local_session() as session: