From 059aa2f83e0acc146e02610049d5f3d2ed9f59b9 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 30 Mar 2016 01:47:50 +0800 Subject: [PATCH] gui: do 60114447 properly --- artiq/gui/state.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/artiq/gui/state.py b/artiq/gui/state.py index 1e9be5532..a167e0fcb 100644 --- a/artiq/gui/state.py +++ b/artiq/gui/state.py @@ -71,13 +71,14 @@ class StateManager(TaskObject): async def _do(self): try: - while True: - await asyncio.sleep(self.autosave_period) + try: + while True: + await asyncio.sleep(self.autosave_period) + self.save() + finally: self.save() except asyncio.CancelledError: pass except: logger.error("Uncaught exception attempting to save state", exc_info=True) - finally: - self.save()