fix(backend): cap graceful shutdown at 3s — the charger's ever-open WebSocket made Ctrl+C hang

uvicorn waits for connections to drain on SIGINT; the JC-6620 never
hangs up, so shutdown blocked until a second (force) Ctrl+C.
timeout_graceful_shutdown=3 closes the socket and exits; the charger
redials within seconds.
This commit is contained in:
2026-07-12 09:07:47 +02:00
parent 069d544bb5
commit 9562fdaf6b
+5 -1
View File
@@ -76,8 +76,12 @@ async def main():
"NO USERS CONFIGURED — the API is OPEN (anonymous admin). " "NO USERS CONFIGURED — the API is OPEN (anonymous admin). "
"Create one: venv\\Scripts\\python -m backend.users add <name> --scopes admin" "Create one: venv\\Scripts\\python -m backend.users add <name> --scopes admin"
) )
# timeout_graceful_shutdown: the charger holds its WebSocket open FOREVER,
# so a graceful "wait for connections to drain" would hang Ctrl+C — cap it.
# The charger reconnects within seconds after a restart anyway.
await uvicorn.Server( await uvicorn.Server(
uvicorn.Config(app, host="0.0.0.0", port=9000, log_config=None) uvicorn.Config(app, host="0.0.0.0", port=9000, log_config=None,
timeout_graceful_shutdown=3)
).serve() ).serve()