async fix?

This commit is contained in:
saces 2026-04-04 10:34:38 +02:00
parent 985e90290d
commit fd535b4a51

View file

@ -61,10 +61,17 @@ class _AsyncClient:
self.UserID = result_dict["userid"] self.UserID = result_dict["userid"]
self.DeviceID = result_dict["deviceid"] self.DeviceID = result_dict["deviceid"]
async def _sync(self): async def _sync_inner(self):
r = ApiV0Api.startclient(self.client_id) r = ApiV0Api.startclient(self.client_id)
CheckApiError(r) CheckApiError(r)
async def _sync(self):
loop = asyncio.new_event_loop()
threading.Thread(
target=loop.run_forever, name="Async Runner", daemon=True
).start()
asyncio.run_coroutine_threadsafe(self._sync_inner(), loop).result()
def _stopsync(self): def _stopsync(self):
r = ApiV0Api.stopclient(self.client_id) r = ApiV0Api.stopclient(self.client_id)
CheckApiError(r) CheckApiError(r)