WebHost: give active rooms a chance to reclaim their port

This commit is contained in:
Fabian Dill 2023-03-24 00:41:06 +01:00 committed by Fabian Dill
parent 384577e421
commit 754a57cf69
1 changed files with 5 additions and 0 deletions

View File

@ -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)