From ad4195712750d115cebe0ef052ded50e5d354c4a Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 13 Feb 2022 17:39:17 +0100 Subject: [PATCH] database not ready events are hard to reproduce consistently --- InvenTree/InvenTree/tasks.py | 4 ++-- InvenTree/part/apps.py | 2 +- InvenTree/plugin/builtin/integration/mixins.py | 2 +- InvenTree/plugin/registry.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/InvenTree/InvenTree/tasks.py b/InvenTree/InvenTree/tasks.py index 52fc946d65..9d4039d4b1 100644 --- a/InvenTree/InvenTree/tasks.py +++ b/InvenTree/InvenTree/tasks.py @@ -47,7 +47,7 @@ def schedule_task(taskname, **kwargs): func=taskname, **kwargs ) - except (OperationalError, ProgrammingError): + except (OperationalError, ProgrammingError): # pragma: no cover # Required if the DB is not ready yet pass @@ -111,7 +111,7 @@ def offload_task(taskname, *args, force_sync=False, **kwargs): except AppRegistryNotReady: # pragma: no cover logger.warning(f"Could not offload task '{taskname}' - app registry not ready") return - except (OperationalError, ProgrammingError): + except (OperationalError, ProgrammingError): # pragma: no cover logger.warning(f"Could not offload task '{taskname}' - database not ready") diff --git a/InvenTree/part/apps.py b/InvenTree/part/apps.py index 49a9f2f90c..93885995ac 100644 --- a/InvenTree/part/apps.py +++ b/InvenTree/part/apps.py @@ -40,6 +40,6 @@ class PartConfig(AppConfig): item.part.trackable = True item.part.clean() item.part.save() - except (OperationalError, ProgrammingError): + except (OperationalError, ProgrammingError): # pragma: no cover # Exception if the database has not been migrated yet pass diff --git a/InvenTree/plugin/builtin/integration/mixins.py b/InvenTree/plugin/builtin/integration/mixins.py index 7306a30a3c..1e6b7e38b7 100644 --- a/InvenTree/plugin/builtin/integration/mixins.py +++ b/InvenTree/plugin/builtin/integration/mixins.py @@ -51,7 +51,7 @@ class SettingsMixin: try: plugin, _ = PluginConfig.objects.get_or_create(key=self.plugin_slug(), name=self.plugin_name()) - except (OperationalError, ProgrammingError): + except (OperationalError, ProgrammingError): # pragma: no cover plugin = None if not plugin: diff --git a/InvenTree/plugin/registry.py b/InvenTree/plugin/registry.py index 2cd8311e0f..aec38cc623 100644 --- a/InvenTree/plugin/registry.py +++ b/InvenTree/plugin/registry.py @@ -102,7 +102,7 @@ class PluginsRegistry: self._init_plugins(blocked_plugin) self._activate_plugins() registered_successful = True - except (OperationalError, ProgrammingError): + except (OperationalError, ProgrammingError): # pragma: no cover # Exception if the database has not been migrated yet logger.info('Database not accessible while loading plugins') break