race-fix8

This commit is contained in:
Untone 2023-10-13 03:28:00 +03:00
parent 55c75f2a2e
commit 4d79334dbc

View File

@ -8,8 +8,6 @@ from .chats import create_chat
from .unread import get_unread_counter
import asyncio
lock = asyncio.Lock()
# NOTE: not an API handler
async def load_messages(chat_id: str, limit: int = 5, offset: int = 0, ids=None):
@ -52,6 +50,7 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0):
cids = cids[offset:(offset + limit)]
members_online = (await redis.execute("SMEMBERS", "authors-online")) or []
chats = []
lock = asyncio.Lock()
if len(cids) == 0:
print(f"[resolvers.load] no chats for user with id={author_id}, create one with Discours (id=2)")
r = await create_chat(None, info, members=[2]) # member with id = 2 is discours