From 9d12a7172c5927f20b321649dbc7b73a473bcfd5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 13 Feb 2022 17:35:07 +0100 Subject: [PATCH] use same style for AppNotReady Exception --- InvenTree/InvenTree/apps.py | 4 ++-- InvenTree/InvenTree/tasks.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/InvenTree/InvenTree/apps.py b/InvenTree/InvenTree/apps.py index 003f48f8a3..76b918459c 100644 --- a/InvenTree/InvenTree/apps.py +++ b/InvenTree/InvenTree/apps.py @@ -38,7 +38,7 @@ class InvenTreeConfig(AppConfig): try: from django_q.models import Schedule - except (AppRegistryNotReady): + except AppRegistryNotReady: # pragma: no cover return # Remove any existing obsolete tasks @@ -48,7 +48,7 @@ class InvenTreeConfig(AppConfig): try: from django_q.models import Schedule - except (AppRegistryNotReady): + except AppRegistryNotReady: # pragma: no cover return logger.info("Starting background tasks...") diff --git a/InvenTree/InvenTree/tasks.py b/InvenTree/InvenTree/tasks.py index 58a7a8126d..52fc946d65 100644 --- a/InvenTree/InvenTree/tasks.py +++ b/InvenTree/InvenTree/tasks.py @@ -28,7 +28,7 @@ def schedule_task(taskname, **kwargs): try: from django_q.models import Schedule - except (AppRegistryNotReady): + except AppRegistryNotReady: # pragma: no cover logger.info("Could not start background tasks - App registry not ready") return @@ -108,7 +108,7 @@ def offload_task(taskname, *args, force_sync=False, **kwargs): # Workers are not running: run it as synchronous task _func(*args, **kwargs) - except (AppRegistryNotReady): + except AppRegistryNotReady: # pragma: no cover logger.warning(f"Could not offload task '{taskname}' - app registry not ready") return except (OperationalError, ProgrammingError):