mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-31 12:44:52 +00:00
Fix Syncer not creating Event and Lock objects inside the current loop
This commit is contained in:
parent
7c3bbb3fc7
commit
b3d6b41ca8
1 changed files with 8 additions and 2 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue