mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-07 15:34: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
|
INTERVAL = 20
|
||||||
|
|
||||||
clients = {}
|
clients = {}
|
||||||
event = asyncio.Event()
|
event = None
|
||||||
lock = asyncio.Lock()
|
lock = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def add(cls, client):
|
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:
|
with await cls.lock:
|
||||||
cls.sync(client)
|
cls.sync(client)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue