From 754a57cf690d3d8aa5689419114fece393ca9dfc Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 24 Mar 2023 00:41:06 +0100 Subject: [PATCH] WebHost: give active rooms a chance to reclaim their port --- WebHostLib/customserver.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/WebHostLib/customserver.py b/WebHostLib/customserver.py index 6e7da407..fa392492 100644 --- a/WebHostLib/customserver.py +++ b/WebHostLib/customserver.py @@ -203,6 +203,11 @@ def run_server_process(room_id, ponyconfig: dict, static_server_data: dict, with Locker(room_id): try: asyncio.run(main()) + except KeyboardInterrupt: + with db_session: + room = Room.get(id=room_id) + # ensure the Room does not spin up again on its own, minute of safety buffer + room.last_activity = datetime.datetime.utcnow() - datetime.timedelta(minutes=1, seconds=room.timeout) except: with db_session: room = Room.get(id=room_id)