From 735966d163bc7478f90e78371e1f8871dbd28846 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 13 Dec 2019 12:02:06 +1300 Subject: [PATCH] use run_in_bg for uploading crash reports --- subiquity/controllers/error.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subiquity/controllers/error.py b/subiquity/controllers/error.py index 227b8b91..2bfb1695 100644 --- a/subiquity/controllers/error.py +++ b/subiquity/controllers/error.py @@ -238,9 +238,9 @@ class ErrorReport(metaclass=urwid.MetaSignals): response.raise_for_status() return response.text.split()[0] - def uploaded(fut): + async def upload(): try: - oops_id = fut.result() + oops_id = await run_in_thread(_bg_upload) except requests.exceptions.RequestException: log.exception("upload for %s failed", self.base) else: @@ -252,7 +252,8 @@ class ErrorReport(metaclass=urwid.MetaSignals): urwid.emit_signal(self, 'changed') uploader.start() - self.controller.run_in_bg(_bg_upload, uploaded) + + schedule_task(upload()) def _path_with_ext(self, ext): return os.path.join(