Customserver: only save on exit if it's in a good state. (#3351)
This commit is contained in:
parent
fe7bc8784d
commit
461f5db35a
|
@ -270,15 +270,19 @@ def run_server_process(name: str, ponyconfig: dict, static_server_data: dict,
|
||||||
await ctx.shutdown_task
|
await ctx.shutdown_task
|
||||||
|
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
pass
|
if ctx.saving:
|
||||||
except Exception:
|
ctx._save()
|
||||||
|
except Exception as e:
|
||||||
with db_session:
|
with db_session:
|
||||||
room = Room.get(id=room_id)
|
room = Room.get(id=room_id)
|
||||||
room.last_port = -1
|
room.last_port = -1
|
||||||
|
logger.exception(e)
|
||||||
raise
|
raise
|
||||||
|
else:
|
||||||
|
if ctx.saving:
|
||||||
|
ctx._save()
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
ctx._save()
|
|
||||||
with (db_session):
|
with (db_session):
|
||||||
# ensure the Room does not spin up again on its own, minute of safety buffer
|
# ensure the Room does not spin up again on its own, minute of safety buffer
|
||||||
room = Room.get(id=room_id)
|
room = Room.get(id=room_id)
|
||||||
|
|
Loading…
Reference in New Issue