Fix flight-plans no longer being highlighted

Bug introduced as part of the upgrade to Python 3.11?
This commit is contained in:
Raffson 2024-04-14 14:15:02 +02:00
parent f76fe6eeec
commit 09ddc3c3c6
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -1,4 +1,4 @@
from asyncio import wait
from asyncio import wait, tasks
from fastapi import APIRouter, WebSocket
from fastapi.encoders import jsonable_encoder
@ -17,8 +17,8 @@ class ConnectionManager:
async def shutdown(self) -> None:
futures = []
for connection in self.active_connections:
futures.append(connection.close())
await wait(futures) # type: ignore
futures.append(tasks.create_task(connection.close()))
await wait(futures)
async def connect(self, websocket: WebSocket) -> None:
await websocket.accept()
@ -30,8 +30,10 @@ class ConnectionManager:
async def broadcast(self, events: GameUpdateEventsJs) -> None:
futures = []
for connection in self.active_connections:
futures.append(connection.send_json(jsonable_encoder(events)))
await wait(futures) # type: ignore
futures.append(
tasks.create_task(connection.send_json(jsonable_encoder(events)))
)
await wait(futures)
manager = ConnectionManager()