logfix
All checks were successful
deploy / deploy (push) Successful in 1m10s

This commit is contained in:
Untone 2024-04-19 11:41:02 +03:00
parent 12c5d2677d
commit c96e8afc45
2 changed files with 12 additions and 10 deletions

View File

@ -66,11 +66,14 @@ async def create_chat(_, info, title="", members=None):
if len(members) == 2 and title == "":
chatset1 = await redis.execute("SMEMBERS", f"chats_by_author/{members[0]}")
chatset2 = await redis.execute("SMEMBERS", f"chats_by_author/{members[1]}")
for c in chatset1.intersection(chatset2):
chat = await redis.execute("GET", f"chats/{c}")
if chat["title"] == "":
logger.info("[inbox] createChat found old chat")
return {"chat": chat, "error": "existed"}
if isinstance(chatset1, set) and isinstance(chatset2, set):
for c in chatset1.intersection(chatset2):
chat_result = await redis.execute("GET", f"chats/{c}")
if chat_result:
chat = json.loads(chat_result)
if chat["title"] == "":
logger.info("[inbox] createChat found old chat")
return {"chat": chat, "error": "existed"}
chat_id = str(uuid.uuid4())
chat: Chat = {

View File

@ -88,11 +88,10 @@ async def load_chats(
lock = asyncio.Lock()
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
logger.debug(f"created chat: {r['chat_id']}")
cids.append(r["chat"]["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"])
logger.debug(f"getting data for {len(cids)} user's chats")
for cid in cids: