This commit is contained in:
parent
2d538a292a
commit
a4957ef0ad
|
@ -197,14 +197,13 @@ def get_with_stat(q):
|
||||||
|
|
||||||
|
|
||||||
async def get_authors_with_stat_cached(q):
|
async def get_authors_with_stat_cached(q):
|
||||||
logger.debug(q)
|
# logger.debug(q)
|
||||||
try:
|
try:
|
||||||
records = []
|
records = []
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
for [x] in session.execute(q):
|
for [x] in session.execute(q):
|
||||||
stat_str = await redis.execute('GET', f'author:{x.id}')
|
stat_str = await redis.execute('GET', f'author:{x.id}')
|
||||||
if isinstance(stat_str, str):
|
x.stat = json.loads(stat_str).get('stat') if isinstance(stat_str, str) else {}
|
||||||
x.stat = json.loads(stat_str).get('stat')
|
|
||||||
records.append(x)
|
records.append(x)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
raise Exception(exc)
|
raise Exception(exc)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user