mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix: wire keepalive_timeout through to gunicorn server path
The KEEPALIVE_TIMEOUT env var / --keepalive_timeout CLI flag was only wired to uvicorn's timeout_keep_alive parameter. The gunicorn code path was missing this, causing a mismatch between ALB idle timeout and proxy keep-alive when running with --run_gunicorn. Fix: Add keepalive_timeout parameter to _run_gunicorn_server and set gunicorn's 'keepalive' option accordingly. Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
This commit is contained in:
parent
ab4899c318
commit
2d66fa1824
1 changed files with 6 additions and 0 deletions
|
|
@ -188,6 +188,7 @@ class ProxyInitializationHelpers:
|
|||
ssl_certfile_path: str,
|
||||
ssl_keyfile_path: str,
|
||||
max_requests_before_restart: Optional[int] = None,
|
||||
keepalive_timeout: Optional[int] = None,
|
||||
):
|
||||
"""
|
||||
Run litellm with `gunicorn`
|
||||
|
|
@ -272,6 +273,10 @@ class ProxyInitializationHelpers:
|
|||
if max_requests_before_restart is not None:
|
||||
gunicorn_options["max_requests"] = max_requests_before_restart
|
||||
|
||||
# Wire keepalive timeout through to gunicorn (matches uvicorn's timeout_keep_alive)
|
||||
if keepalive_timeout is not None:
|
||||
gunicorn_options["keepalive"] = keepalive_timeout
|
||||
|
||||
if ssl_certfile_path is not None and ssl_keyfile_path is not None:
|
||||
print( # noqa
|
||||
f"\033[1;32mLiteLLM Proxy: Using SSL with certfile: {ssl_certfile_path} and keyfile: {ssl_keyfile_path}\033[0m\n" # noqa
|
||||
|
|
@ -860,6 +865,7 @@ def run_server( # noqa: PLR0915
|
|||
ssl_certfile_path=ssl_certfile_path,
|
||||
ssl_keyfile_path=ssl_keyfile_path,
|
||||
max_requests_before_restart=max_requests_before_restart,
|
||||
keepalive_timeout=keepalive_timeout,
|
||||
)
|
||||
elif run_hypercorn is True:
|
||||
ProxyInitializationHelpers._init_hypercorn_server(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue