mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-31 06:16:06 +00:00
Fix Syncer not creating Event and Lock objects inside the current loop
This commit is contained in:
@@ -33,11 +33,17 @@ class Syncer:
|
||||
INTERVAL = 20
|
||||
|
||||
clients = {}
|
||||
event = asyncio.Event()
|
||||
lock = asyncio.Lock()
|
||||
event = None
|
||||
lock = None
|
||||
|
||||
@classmethod
|
||||
async def add(cls, client):
|
||||
if cls.event is None:
|
||||
cls.event = asyncio.Event()
|
||||
|
||||
if cls.lock is None:
|
||||
cls.lock = asyncio.Lock()
|
||||
|
||||
with await cls.lock:
|
||||
cls.sync(client)
|
||||
|
||||
|
Reference in New Issue
Block a user