mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +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:
@@ -6,8 +6,10 @@ from threading import Thread
|
||||
import uvicorn
|
||||
from uvicorn import Config
|
||||
|
||||
from game.server import EventStream
|
||||
from game.server.app import app
|
||||
from game.server.settings import ServerSettings
|
||||
from game.sim import GameUpdateEvents
|
||||
|
||||
|
||||
class Server(uvicorn.Server):
|
||||
@@ -34,4 +36,5 @@ class Server(uvicorn.Server):
|
||||
yield
|
||||
finally:
|
||||
self.should_exit = True
|
||||
EventStream.put_nowait(GameUpdateEvents().shut_down())
|
||||
thread.join()
|
||||
|
||||
Reference in New Issue
Block a user