Fixed too many auto-saves occuring after restart.

- Now the 'All results are up to date' message and auto-save only
  occurs the moment that the last pending result is calculated.
This commit is contained in:
Andrew Hamilton 2018-08-17 22:59:16 +10:00
parent 2c402a683a
commit bf8d35f2f3

View file

@ -47,12 +47,6 @@ class Worker:
self.result = await summary.get_closest_placeholder()
except StopAsyncIteration:
self.result = None
if summary.result_total == summary.completed_total:
log.log_message("All results are up to date.")
log.log_message(Worker.AUTOSAVE_MESSAGE)
screen.save()
if self.is_being_tested:
os.kill(os.getpid(), signal.SIGINT)
break
await self.result.run(log, appearance_changed_event, self)
Worker.unsaved_jobs_total += 1
@ -60,6 +54,12 @@ class Worker:
log.log_message(Worker.AUTOSAVE_MESSAGE)
screen.save()
summary.completed_total += 1
if summary.result_total == summary.completed_total:
log.log_message("All results are up to date.")
log.log_message(Worker.AUTOSAVE_MESSAGE)
screen.save()
if self.is_being_tested:
os.kill(os.getpid(), signal.SIGINT)
jobs_added_event.clear()
def pause(self):