mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix server shut down on exit.
If there's a websocket being waited on the shut down won't actually happen. Add a new event for shut down and send it to break the websocket out of its loop.
This commit is contained in:
@@ -14,6 +14,10 @@ async def event_stream(websocket: WebSocket) -> None:
|
||||
await websocket.accept()
|
||||
while True:
|
||||
if not (events := await EventStream.get()).empty:
|
||||
if events.shutting_down:
|
||||
await websocket.close()
|
||||
return
|
||||
|
||||
await websocket.send_json(
|
||||
jsonable_encoder(
|
||||
GameUpdateEventsJs.from_events(events, GameContext.get())
|
||||
|
||||
Reference in New Issue
Block a user