Skip to content

Commit

Permalink
Customserver: only save on exit if it's in a good state.
Browse files Browse the repository at this point in the history
Customserver: log exception for room host failure to log.
  • Loading branch information
Berserker66 committed May 20, 2024
1 parent 3043724 commit 1929fd2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions WebHostLib/customserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,17 @@ async def start_room(room_id):
await ctx.shutdown_task

except (KeyboardInterrupt, SystemExit):
pass
except Exception:
ctx._save()
except Exception as e:
with db_session:
room = Room.get(id=room_id)
room.last_port = -1
logger.exception(e)
raise
else:
ctx._save()
finally:
try:
ctx._save()
with (db_session):
# ensure the Room does not spin up again on its own, minute of safety buffer
room = Room.get(id=room_id)
Expand Down

0 comments on commit 1929fd2

Please sign in to comment.