From 453cd1cc70065ffbf8a6277284ac3b6f9e5699b9 Mon Sep 17 00:00:00 2001 From: Romuald Juchnowicz-Bierbasz Date: Tue, 3 Dec 2019 14:06:48 +0100 Subject: [PATCH] Do not send notificaitons when import is cancelled --- src/galaxy/api/plugin.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/galaxy/api/plugin.py b/src/galaxy/api/plugin.py index 3a7fd8a..95d9c5a 100644 --- a/src/galaxy/api/plugin.py +++ b/src/galaxy/api/plugin.py @@ -66,6 +66,8 @@ class Importer: self._notification_success(id_, element) except ApplicationError as error: self._notification_failure(id_, error) + except asyncio.CancelledError: + pass except Exception: logger.exception("Unexpected exception raised in %s importer", self._name) self._notification_failure(id_, UnknownError()) @@ -74,10 +76,12 @@ class Importer: try: imports = [import_element(id_, context_) for id_ in ids_] await asyncio.gather(*imports) - finally: self._notification_finished() - self._import_in_progress = False self._complete() + except asyncio.CancelledError: + logger.debug("Importing %s cancelled", self._name) + finally: + self._import_in_progress = False self._task_manager.create_task( import_elements(ids, context),