cache-events-fix

This commit is contained in:
2024-03-12 14:59:36 +03:00
parent 91ffcb85df
commit 37319c2091
5 changed files with 142 additions and 132 deletions

View File

@@ -2,7 +2,7 @@ import asyncio
import json
import time
from sqlalchemy import select, or_, and_, text, desc, literal
from sqlalchemy import select, or_, and_, text, desc
from sqlalchemy.orm import aliased
from sqlalchemy_searchable import search
@@ -52,7 +52,7 @@ async def get_author(_, _info, slug='', author_id=None):
if author_id:
cache = await redis.execute('GET', f'id:{author_id}:author')
logger.debug(f'result from cache: {cache}')
q = select(Author).where(Author.id == literal(author_id))
q = select(Author).where(Author.id == author_id)
author_dict = None
if cache:
author_dict = json.loads(cache)