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

This commit is contained in:
2024-02-26 05:43:35 +03:00
parent 8fb161470f
commit ebbbe05237
2 changed files with 4 additions and 4 deletions

View File

@@ -49,10 +49,10 @@ async def get_author(_, _info, slug='', author_id=None):
if author_id:
cache = await redis.execute('GET', f'id:{author_id}:author')
q = select(Author).where(Author.id == author_id)
author = json.loads(cache) if cache else get_with_stat(q)[0]
author_dict = json.loads(cache) if cache else get_with_stat(q)[0].dict()
if author:
await update_author_cache(author.dict())
return author
await update_author_cache(author_dict)
return author_dict
except Exception:
import traceback
exc = traceback.format_exc()