From 1a1128cc8c981a38d268d96f9ce4bcb8cef0db64 Mon Sep 17 00:00:00 2001 From: ValueOn AG Date: Mon, 25 May 2026 16:05:15 +0200 Subject: [PATCH] fixed shutdown isue --- Dockerfile | 3 +-- app.py | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f476a47c..e8300a5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,5 +46,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ CMD python -c "import requests; requests.get('http://localhost:8000/api/admin/health', timeout=5)" || exit 1 # Run the application -# Cloud Run will set PORT env var, uvicorn reads it automatically -CMD exec uvicorn app:app --host 0.0.0.0 --port ${PORT:-8000} --workers 1 +CMD exec uvicorn app:app --host 0.0.0.0 --port ${PORT:-8000} --workers 1 --timeout-graceful-shutdown 5 diff --git a/app.py b/app.py index 3bb9dcc9..b53caebc 100644 --- a/app.py +++ b/app.py @@ -723,4 +723,11 @@ app.include_router(automationWorkspaceRouter) from modules.system.registry import loadFeatureRouters featureLoadResults = loadFeatureRouters(app) -logger.info(f"Feature router load results: {featureLoadResults}") \ No newline at end of file +logger.info(f"Feature router load results: {featureLoadResults}") + + +if __name__ == "__main__": + import uvicorn + + port = int(os.environ.get("PORT", 8000)) + uvicorn.run("app:app", host="0.0.0.0", port=port, workers=1, timeout_graceful_shutdown=5) \ No newline at end of file