Replace GUNICORN_CMD_ARGS with custom LIGHTRAG_GUNICORN_MODE flag
• Use custom env var for mode detection • Improve Gunicorn mode reliability
This commit is contained in:
parent
816feefd84
commit
4a46d39c93
2 changed files with 4 additions and 2 deletions
|
|
@ -328,8 +328,7 @@ def create_app(args):
|
||||||
|
|
||||||
# In Gunicorn mode with preload_app=True, cleanup is handled by worker_exit/on_exit hooks
|
# In Gunicorn mode with preload_app=True, cleanup is handled by worker_exit/on_exit hooks
|
||||||
# Only perform cleanup in Uvicorn single-process mode
|
# Only perform cleanup in Uvicorn single-process mode
|
||||||
if "GUNICORN_CMD_ARGS" not in os.environ:
|
if "LIGHTRAG_GUNICORN_MODE" not in os.environ:
|
||||||
|
|
||||||
# Clean up shared data
|
# Clean up shared data
|
||||||
finalize_share_data()
|
finalize_share_data()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@ def check_and_install_dependencies():
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
# Set Gunicorn mode flag for lifespan cleanup detection
|
||||||
|
os.environ["LIGHTRAG_GUNICORN_MODE"] = "1"
|
||||||
|
|
||||||
# Check .env file
|
# Check .env file
|
||||||
if not check_env_file():
|
if not check_env_file():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue