diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 88cd09072e..b1714c320a 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -885,7 +885,6 @@ PLUGINS = [] INTEGRATION_PLUGIN_GLOBALSETTING = {} INTEGRATION_APPS_LOADING = True # Marks if apps were reloaded yet -INTEGRATION_PLUGINS_RELOADING = False INTEGRATION_APPS_PATHS = [] # Holds all added plugin_paths INTEGRATION_ERRORS = {} # Holds discovering errors diff --git a/InvenTree/plugin/apps.py b/InvenTree/plugin/apps.py index c184803506..2b9f3e1d8b 100644 --- a/InvenTree/plugin/apps.py +++ b/InvenTree/plugin/apps.py @@ -11,6 +11,6 @@ class PluginAppConfig(AppConfig): name = 'plugin' def ready(self): - if not settings.INTEGRATION_PLUGINS_RELOADING: + if not plugins.is_loading: plugins.collect_plugins() plugins.load_plugins() diff --git a/InvenTree/plugin/registry.py b/InvenTree/plugin/registry.py index 8bb18acaac..7440a7e116 100644 --- a/InvenTree/plugin/registry.py +++ b/InvenTree/plugin/registry.py @@ -35,9 +35,13 @@ logger = logging.getLogger('inventree') class Plugins: def __init__(self) -> None: + # plugin registry self.plugins = {} self.plugins_inactive = {} + # flags + self.is_loading = False + # region public plugin functions def load_plugins(self): """load and activate all IntegrationPlugins""" @@ -393,9 +397,9 @@ class Plugins: apps.clear_cache() self._try_reload(apps.populate, settings.INSTALLED_APPS) - settings.INTEGRATION_PLUGINS_RELOADING = True + self.is_loading = True self._try_reload(apps.set_installed_apps, settings.INSTALLED_APPS) - settings.INTEGRATION_PLUGINS_RELOADING = False + self.is_loading = False def _try_reload(self, cmd, *args, **kwargs): """