WebHost: Update UTC datetime usage (timezone-naive) (#4906)

This commit is contained in:
josephwhite
2026-03-10 13:57:48 -04:00
committed by GitHub
parent c3659fb3ef
commit 4b37283d22
8 changed files with 42 additions and 24 deletions

View File

@@ -172,7 +172,7 @@ class WebHostContext(Context):
room.multisave = pickle.dumps(self.get_save())
# saving only occurs on activity, so we can "abuse" this information to mark this as last_activity
if not exit_save: # we don't want to count a shutdown as activity, which would restart the server again
room.last_activity = datetime.datetime.utcnow()
room.last_activity = Utils.utcnow()
return True
def get_save(self) -> dict:
@@ -367,8 +367,7 @@ def run_server_process(name: str, ponyconfig: dict, static_server_data: dict,
with db_session:
# ensure the Room does not spin up again on its own, minute of safety buffer
room = Room.get(id=room_id)
room.last_activity = datetime.datetime.utcnow() - \
datetime.timedelta(minutes=1, seconds=room.timeout)
room.last_activity = Utils.utcnow() - datetime.timedelta(minutes=1, seconds=room.timeout)
del room
tear_down_logging(room_id)
logging.info(f"Shutting down room {room_id} on {name}.")