This commit is contained in:
parent
8826af02b5
commit
9d8831d7ed
|
@ -71,6 +71,7 @@ async def get_author(_, _info, slug='', author_id=None):
|
||||||
q = select(Author).where(Author.id == author_id)
|
q = select(Author).where(Author.id == author_id)
|
||||||
[author] = await get_authors_with_stat_cached(q)
|
[author] = await get_authors_with_stat_cached(q)
|
||||||
if author:
|
if author:
|
||||||
|
logger.debug(f'queried author from db {cache_key} -> {cache}')
|
||||||
author_dict = author.dict()
|
author_dict = author.dict()
|
||||||
else:
|
else:
|
||||||
logger.warn('author was not cached!')
|
logger.warn('author was not cached!')
|
||||||
|
|
|
@ -197,6 +197,7 @@ def get_with_stat(q):
|
||||||
|
|
||||||
|
|
||||||
async def get_authors_with_stat_cached(q):
|
async def get_authors_with_stat_cached(q):
|
||||||
|
logger.debug(q)
|
||||||
try:
|
try:
|
||||||
records = []
|
records = []
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
|
|
|
@ -93,6 +93,7 @@ def before_cursor_execute(conn, cursor, statement, parameters, context, executem
|
||||||
conn.query_start_time = time.time()
|
conn.query_start_time = time.time()
|
||||||
conn.last_statement = ''
|
conn.last_statement = ''
|
||||||
|
|
||||||
|
|
||||||
@event.listens_for(Engine, 'after_cursor_execute')
|
@event.listens_for(Engine, 'after_cursor_execute')
|
||||||
def after_cursor_execute(conn, cursor, statement, parameters, context, executemany):
|
def after_cursor_execute(conn, cursor, statement, parameters, context, executemany):
|
||||||
compiled_statement = context.compiled.string
|
compiled_statement = context.compiled.string
|
||||||
|
|
Loading…
Reference in New Issue
Block a user