From 4c058b4b988c8bdcd396993c5a008a4bf3462c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Boschi?= Date: Thu, 5 Mar 2026 11:35:23 +0100 Subject: [PATCH] fix: cap uvicorn graceful shutdown at 5s and enable force-kill on double Ctrl+C (#495) Add timeout_graceful_shutdown=5 to uvicorn config to prevent the 30-second shutdown delay and enable force-kill behavior on a second Ctrl+C signal. --- hindsight-api/hindsight_api/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hindsight-api/hindsight_api/main.py b/hindsight-api/hindsight_api/main.py index c255a251..cf18897f 100644 --- a/hindsight-api/hindsight_api/main.py +++ b/hindsight-api/hindsight_api/main.py @@ -389,6 +389,7 @@ def main(): "ws": "wsproto", # Use wsproto instead of websockets to avoid deprecation warnings "loop": loop_impl, # Explicitly set event loop implementation "timeout_keep_alive": 30, # Exceed aiohttp's 15s client timeout so the client always closes first + "timeout_graceful_shutdown": 5, # Cap graceful shutdown at 5s; also enables force-kill on second Ctrl+C } # Add optional parameters if provided