debug-topics

This commit is contained in:
Untone 2024-03-12 16:21:28 +03:00
parent 6064f0326a
commit 358cc86197

View File

@ -216,13 +216,16 @@ async def get_authors_with_stat_cached(q):
async def get_topics_with_stat_cached(q):
try:
records = []
current = None
with local_session() as session:
for x in session.execute(q):
current = x
stat_str = await redis.execute('GET', f'topic:{x.id}')
if isinstance(stat_str, str):
x.stat = json.loads(stat_str).get('stat')
records.append(x)
except Exception as exc:
logger.error(current)
raise Exception(exc)
return records