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.
This commit is contained in:
Nicolò Boschi 2026-03-05 11:35:23 +01:00 committed by GitHub
parent aa8e5475c4
commit 4c058b4b98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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