2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 03:30:54 +00:00
* Update "isRunningMigrations" method

* Update other apps.py files
This commit is contained in:
Oliver
2024-01-11 00:35:25 +11:00
committed by GitHub
parent e1b670ba57
commit 445551e6f3
7 changed files with 46 additions and 26 deletions

View File

@ -4,7 +4,7 @@ import logging
from django.apps import AppConfig
from InvenTree.ready import isImportingData
import InvenTree.ready
logger = logging.getLogger('inventree')
@ -19,6 +19,10 @@ class CommonConfig(AppConfig):
def ready(self):
"""Initialize restart flag clearance on startup."""
if InvenTree.ready.isRunningMigrations():
return
self.clear_restart_flag()
def clear_restart_flag(self):
@ -29,7 +33,7 @@ class CommonConfig(AppConfig):
if common.models.InvenTreeSetting.get_setting('SERVER_RESTART_REQUIRED', backup_value=False, create=False, cache=False):
logger.info("Clearing SERVER_RESTART_REQUIRED flag")
if not isImportingData():
if not InvenTree.ready.isImportingData():
common.models.InvenTreeSetting.set_setting('SERVER_RESTART_REQUIRED', False, None)
except Exception:
pass