From 56ac6573f128048bd957e246ecf85bdf502805e2 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 6 Dec 2023 18:24:13 +0100 Subject: [PATCH] WebHost: fix room shutdown (#2554) Currently when a room shuts down while clients are connected it instantly spins back up. This fixes that behaviour categorically. I still don't know why or when this problem started, but it's certainly wreaking havok on prod. --- WebHostLib/customserver.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/WebHostLib/customserver.py b/WebHostLib/customserver.py index 998fec5e..fb3b3147 100644 --- a/WebHostLib/customserver.py +++ b/WebHostLib/customserver.py @@ -205,6 +205,12 @@ def run_server_process(room_id, ponyconfig: dict, static_server_data: dict, ctx.auto_shutdown = Room.get(id=room_id).timeout ctx.shutdown_task = asyncio.create_task(auto_shutdown(ctx, [])) await ctx.shutdown_task + + # ensure auto launch is on the same page in regard to room activity. + with db_session: + room: Room = Room.get(id=ctx.room_id) + room.last_activity = datetime.datetime.utcnow() - datetime.timedelta(seconds=room.timeout + 60) + logging.info("Shutting down") with Locker(room_id):