mirror of
https://github.com/inventree/InvenTree.git
synced 2026-02-19 13:18:03 +00:00
Fix for ready.py (#11346)
* Fix for ready.py - Early exit for isGeneratingSchema when removing stale content types - Prevents blocking on update process * Rearrange
This commit is contained in:
@@ -6,6 +6,8 @@ import os
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
import structlog
|
||||
|
||||
logger = structlog.get_logger('inventree')
|
||||
@@ -59,7 +61,13 @@ def isRunningMigrations():
|
||||
def isRebuildingData():
|
||||
"""Return true if any of the rebuilding commands are being executed."""
|
||||
return any(
|
||||
x in sys.argv for x in ['rebuild_models', 'rebuild_thumbnails', 'rebuild']
|
||||
x in sys.argv
|
||||
for x in [
|
||||
'rebuild',
|
||||
'rebuild_models',
|
||||
'rebuild_thumbnails',
|
||||
'remove_stale_contenttypes',
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -104,9 +112,12 @@ def isGeneratingSchema():
|
||||
if not result:
|
||||
# We should only get here if we *are* generating schema
|
||||
# Any other time this is called, it should be from a server thread, worker thread, or test mode
|
||||
logger.warning(
|
||||
'isGeneratingSchema called outside of expected contexts - this may be a sign of a problem with the ready() function'
|
||||
)
|
||||
|
||||
if settings.DEBUG:
|
||||
logger.warning(
|
||||
'isGeneratingSchema called outside of expected contexts - this may be a sign of a problem with the ready() function'
|
||||
)
|
||||
logger.warning('sys.argv: %s', sys.argv)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user