diff --git a/resolvers/load.py b/resolvers/load.py index acbd03d..d96f95e 100644 --- a/resolvers/load.py +++ b/resolvers/load.py @@ -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