fix updating after a slow probe

This commit is contained in:
Michael Hudson-Doyle 2019-12-12 23:05:16 +13:00
parent eee1280de4
commit 17251ce431
1 changed files with 6 additions and 2 deletions

View File

@ -118,8 +118,6 @@ class FilesystemController(BaseController):
kind, "block probing", interrupt=False) kind, "block probing", interrupt=False)
continue continue
break break
if self.showing:
self.start_ui()
def start(self): def start(self):
self._start_task = schedule_task(self._start()) self._start_task = schedule_task(self._start())
@ -167,9 +165,15 @@ class FilesystemController(BaseController):
log.debug("_udev_event %s %s", action, dev) log.debug("_udev_event %s %s", action, dev)
self._probe_task.start_sync() self._probe_task.start_sync()
async def _wait_for_probing(self):
await self._probe_task.task
if self.showing:
self.start_ui()
def start_ui(self): def start_ui(self):
if not self._probe_task.task.done(): if not self._probe_task.task.done():
self.ui.set_body(SlowProbing(self)) self.ui.set_body(SlowProbing(self))
schedule_task(self._wait_for_probing())
elif True in self._crash_reports: elif True in self._crash_reports:
self.ui.set_body(ProbingFailed(self)) self.ui.set_body(ProbingFailed(self))
self.ui.body.show_error() self.ui.body.show_error()