Skip to content

Commit 51f5af9

Browse files
Berserker66qwint
authored andcommitted
Customserver: only save on exit if it's in a good state. (ArchipelagoMW#3351)
1 parent 63661d9 commit 51f5af9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

WebHostLib/customserver.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,19 @@ async def start_room(room_id):
270270
await ctx.shutdown_task
271271

272272
except (KeyboardInterrupt, SystemExit):
273-
pass
274-
except Exception:
273+
if ctx.saving:
274+
ctx._save()
275+
except Exception as e:
275276
with db_session:
276277
room = Room.get(id=room_id)
277278
room.last_port = -1
279+
logger.exception(e)
278280
raise
281+
else:
282+
if ctx.saving:
283+
ctx._save()
279284
finally:
280285
try:
281-
ctx._save()
282286
with (db_session):
283287
# ensure the Room does not spin up again on its own, minute of safety buffer
284288
room = Room.get(id=room_id)

0 commit comments

Comments
 (0)