mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Python 3.11 compatibility.
https://docs.python.org/3/library/asyncio-task.html#asyncio.wait says: > Changed in version 3.11: Passing coroutine objects to wait() directly > is forbidden.
This commit is contained in:
parent
7167e84a8f
commit
a1af4e563a
@ -1,3 +1,4 @@
|
|||||||
|
import asyncio
|
||||||
from asyncio import wait
|
from asyncio import wait
|
||||||
|
|
||||||
from fastapi import APIRouter, WebSocket
|
from fastapi import APIRouter, WebSocket
|
||||||
@ -30,7 +31,9 @@ class ConnectionManager:
|
|||||||
async def broadcast(self, events: GameUpdateEventsJs) -> None:
|
async def broadcast(self, events: GameUpdateEventsJs) -> None:
|
||||||
futures = []
|
futures = []
|
||||||
for connection in self.active_connections:
|
for connection in self.active_connections:
|
||||||
futures.append(connection.send_json(jsonable_encoder(events)))
|
futures.append(
|
||||||
|
asyncio.create_task(connection.send_json(jsonable_encoder(events)))
|
||||||
|
)
|
||||||
await wait(futures)
|
await wait(futures)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user