logger-fix-getchat-fix
This commit is contained in:
@@ -75,13 +75,13 @@ async def load_chats(
|
||||
chats = []
|
||||
try:
|
||||
if author_id:
|
||||
logger.debug("got author", author_id)
|
||||
logger.debug(f"got author {author_id}")
|
||||
cids = await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")
|
||||
logger.debug("got cids", cids)
|
||||
logger.debug(f"got cids {cids}")
|
||||
members_online = (
|
||||
await redis.execute("SMEMBERS", "authors-online")
|
||||
) or [] # to show online status
|
||||
logger.debug("members online", members_online)
|
||||
logger.debug(f"members online: {members_online}")
|
||||
if isinstance(cids, set):
|
||||
# TODO: add sort by chat.created_at with in-memory caching chats service
|
||||
cids = list(cids)[offset : (offset + limit)]
|
||||
@@ -89,9 +89,11 @@ async def load_chats(
|
||||
if len(cids) == 0:
|
||||
logger.debug(f"no chats for user with id={author_id}")
|
||||
r = await create_chat(None, info, members=[2]) # member with id = 2 is discours
|
||||
if isinstance(r, dict) and "chat" in r:
|
||||
logger.debug(f"created chat: {r['chat']['id']}")
|
||||
cids.append(r["chat"]["id"])
|
||||
if isinstance(r, dict) and "chat" in r and isinstance(r['chat'], dict):
|
||||
chat_id = r['chat'].get('id')
|
||||
if chat_id:
|
||||
logger.debug(f"created chat: {chat_id}")
|
||||
cids.append(chat_id)
|
||||
|
||||
logger.debug(f"getting data for {len(cids)} user's chats")
|
||||
for cid in cids:
|
||||
|
Reference in New Issue
Block a user