with-stat-cached-fix
All checks were successful
Deploy on push / deploy (push) Successful in 21s

This commit is contained in:
Untone 2024-03-28 19:40:54 +03:00
parent 1f012ae5c9
commit 1eeff25b4d

View File

@ -202,7 +202,7 @@ async def get_authors_with_stat_cached(q):
records = []
with local_session() as session:
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(x, Author) else x}')
x.stat = json.loads(stat_str).get('stat') if isinstance(stat_str, str) else {}
records.append(x)
except Exception as exc: