author-id-faster
Some checks failed
Deploy on push / deploy (push) Failing after 20s

This commit is contained in:
Untone 2024-03-13 12:44:08 +03:00
parent 13e2a4b7ba
commit 13bff800f0

View File

@ -44,12 +44,7 @@ async def get_author(_, _info, slug='', author_id=None):
author = None author = None
try: try:
if slug: if slug:
q = select(Author).select_from(Author).filter(Author.slug == slug) [author_id] = local_session().execute(Author.id).filter(Author.slug == slug).scalar()
result = await get_authors_with_stat_cached(q)
if result:
[author] = result
author_id = author.id
if author_id: if author_id:
cache_key = f'author:{author_id}' cache_key = f'author:{author_id}'
cache = await redis.execute('GET', cache_key) cache = await redis.execute('GET', cache_key)