mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 04:55:44 +00:00
Skip ready functions if not in main thread or plugins are not loaded yet (#5005)
* Skip ready functions if not in main thread or plugins are not loaded yet
* Debug integration tests
* Update ready.py
* Update ready.py
* Fix isInMainThread and isPluginRegistryLoaded ready functions
* Preload gunicorn app to only invoke the appconfig ready functions once
* debug: test prints for statistics
* Remove debug print
* Test without
* Revert "Test without"
This reverts commit 1bc1872893
.
* Second test
* Add checks back to part, label, user model
* Add checks back to inventree, plugin apps
* log server output for debugging
* hopefully I can get the log this time+
* Next test
* Test with --noreload
* Next test
* trigger: ci, because session expired
* block the second ready execution instead of the first
* fix: load order
* Fix test and revert gh actions workflow change
* Added all_apps method to reload machanism
* Changed detect reload mechanism
* Also trigger ready on reload
* Add skipping second reload back for testing mode
* Added doc string back
* Update InvenTree/plugin/base/integration/AppMixin.py
This commit is contained in:
@ -5,7 +5,8 @@ import logging
|
||||
from django.apps import AppConfig
|
||||
from django.db.utils import OperationalError, ProgrammingError
|
||||
|
||||
from InvenTree.ready import canAppAccessDatabase, isImportingData
|
||||
from InvenTree.ready import (canAppAccessDatabase, isImportingData,
|
||||
isInMainThread, isPluginRegistryLoaded)
|
||||
|
||||
logger = logging.getLogger("inventree")
|
||||
|
||||
@ -16,6 +17,10 @@ class PartConfig(AppConfig):
|
||||
|
||||
def ready(self):
|
||||
"""This function is called whenever the Part app is loaded."""
|
||||
# skip loading if plugin registry is not loaded or we run in a background thread
|
||||
if not isPluginRegistryLoaded() or not isInMainThread():
|
||||
return
|
||||
|
||||
if canAppAccessDatabase():
|
||||
self.update_trackable_status()
|
||||
self.reset_part_pricing_flags()
|
||||
|
Reference in New Issue
Block a user