WebHost: prevent infinite spinup loop of Rooms

This commit is contained in:
Fabian Dill
2022-11-04 19:19:04 +01:00
committed by Fabian Dill
parent c3c1ce5827
commit 208a0c6b08
3 changed files with 16 additions and 3 deletions

View File

@@ -184,4 +184,12 @@ def run_server_process(room_id, ponyconfig: dict, static_server_data: dict):
from .autolauncher import Locker
with Locker(room_id):
asyncio.run(main())
try:
asyncio.run(main())
except:
with db_session:
room = Room.get(id=room_id)
room.last_port = -1
# 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)
raise