mirror of
https://github.com/inventree/InvenTree.git
synced 2026-02-19 21:28:00 +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 sys
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
import structlog
|
import structlog
|
||||||
|
|
||||||
logger = structlog.get_logger('inventree')
|
logger = structlog.get_logger('inventree')
|
||||||
@@ -59,7 +61,13 @@ def isRunningMigrations():
|
|||||||
def isRebuildingData():
|
def isRebuildingData():
|
||||||
"""Return true if any of the rebuilding commands are being executed."""
|
"""Return true if any of the rebuilding commands are being executed."""
|
||||||
return any(
|
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:
|
if not result:
|
||||||
# We should only get here if we *are* generating schema
|
# 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
|
# 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
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user