diff --git a/resolvers/author.py b/resolvers/author.py index b0c5aa5b..e64c6e6a 100644 --- a/resolvers/author.py +++ b/resolvers/author.py @@ -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() diff --git a/services/event_listeners.py b/services/event_listeners.py index fa474d10..87745878 100644 --- a/services/event_listeners.py +++ b/services/event_listeners.py @@ -89,7 +89,7 @@ def after_reaction_insert(mapper, connection, reaction: Reaction): authors = get_with_stat(author_query) for author in authors: - asyncio.create_task(update_author_cache(author.author())) + asyncio.create_task(update_author_cache(author.dict())) shout = connection.execute(select(Shout).select_from(Shout).where(Shout.id == reaction.shout)).first() if shout: