mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
use same style for AppNotReady Exception
This commit is contained in:
parent
fe65f92df0
commit
9d12a7172c
@ -38,7 +38,7 @@ class InvenTreeConfig(AppConfig):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from django_q.models import Schedule
|
from django_q.models import Schedule
|
||||||
except (AppRegistryNotReady):
|
except AppRegistryNotReady: # pragma: no cover
|
||||||
return
|
return
|
||||||
|
|
||||||
# Remove any existing obsolete tasks
|
# Remove any existing obsolete tasks
|
||||||
@ -48,7 +48,7 @@ class InvenTreeConfig(AppConfig):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from django_q.models import Schedule
|
from django_q.models import Schedule
|
||||||
except (AppRegistryNotReady):
|
except AppRegistryNotReady: # pragma: no cover
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.info("Starting background tasks...")
|
logger.info("Starting background tasks...")
|
||||||
|
@ -28,7 +28,7 @@ def schedule_task(taskname, **kwargs):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from django_q.models import Schedule
|
from django_q.models import Schedule
|
||||||
except (AppRegistryNotReady):
|
except AppRegistryNotReady: # pragma: no cover
|
||||||
logger.info("Could not start background tasks - App registry not ready")
|
logger.info("Could not start background tasks - App registry not ready")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ def offload_task(taskname, *args, force_sync=False, **kwargs):
|
|||||||
# Workers are not running: run it as synchronous task
|
# Workers are not running: run it as synchronous task
|
||||||
_func(*args, **kwargs)
|
_func(*args, **kwargs)
|
||||||
|
|
||||||
except (AppRegistryNotReady):
|
except AppRegistryNotReady: # pragma: no cover
|
||||||
logger.warning(f"Could not offload task '{taskname}' - app registry not ready")
|
logger.warning(f"Could not offload task '{taskname}' - app registry not ready")
|
||||||
return
|
return
|
||||||
except (OperationalError, ProgrammingError):
|
except (OperationalError, ProgrammingError):
|
||||||
|
Loading…
Reference in New Issue
Block a user