Tray exit lag fix

This commit is contained in:
Flowseal
2026-03-04 18:04:15 +03:00
parent 41d7923079
commit a57be0971f
2 changed files with 21 additions and 3 deletions
+8 -1
View File
@@ -790,7 +790,14 @@ async def _run(port: int, dc_opt: Dict[int, Optional[str]],
async def wait_stop():
await stop_event.wait()
server.close()
await server.wait_closed()
me = asyncio.current_task()
for task in list(asyncio.all_tasks()):
if task is not me:
task.cancel()
try:
await server.wait_closed()
except asyncio.CancelledError:
pass
asyncio.create_task(wait_stop())
async with server: