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

* Update other apps.py files

(cherry picked from commit 445551e6f3)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot]
2024-01-11 00:37:36 +11:00
committed by GitHub
parent 8708ec9bac
commit 78b559306b
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