Fix Syncer not creating Event and Lock objects inside the current loop

This commit is contained in:
Dan 2019-06-05 11:28:29 +02:00
parent 7c3bbb3fc7
commit b3d6b41ca8

View file

@ -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)