From 4d79334dbc56d7ee3f972b4e2bb621a3433245cc Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 13 Oct 2023 03:28:00 +0300 Subject: [PATCH] race-fix8 --- resolvers/load.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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