diff --git a/litellm/proxy/proxy_cli.py b/litellm/proxy/proxy_cli.py index 75d11dd9a17..eb40d7c2d0e 100644 --- a/litellm/proxy/proxy_cli.py +++ b/litellm/proxy/proxy_cli.py @@ -1085,7 +1085,7 @@ def run_server( db_connection_timeout: int | float | None = 60 db_connect_timeout: int | float | None = None db_socket_timeout: int | float | None = None - db_connection_idle_lifetime: int | float | None = ( + db_connection_idle_lifetime: int | float | None = ( # rebind-ok: overwritten from general_settings when a config is provided LiteLLMDatabaseConnectionPool.database_connection_idle_lifetime.value ) db_disable_prepared_statements: bool = False @@ -1190,7 +1190,7 @@ def run_server( db_connection_timeout = LiteLLMDatabaseConnectionPool.database_connection_pool_timeout.value db_connect_timeout = general_settings.get("database_connect_timeout") db_socket_timeout = general_settings.get("database_socket_timeout") - db_connection_idle_lifetime = general_settings.get( + db_connection_idle_lifetime = general_settings.get( # rebind-ok: default declared above for the no-config path "database_connection_idle_lifetime", LiteLLMDatabaseConnectionPool.database_connection_idle_lifetime.value, ) diff --git a/tests/test_litellm/proxy/test_proxy_cli.py b/tests/test_litellm/proxy/test_proxy_cli.py index b77824b5895..9f4ec20ce16 100644 --- a/tests/test_litellm/proxy/test_proxy_cli.py +++ b/tests/test_litellm/proxy/test_proxy_cli.py @@ -919,8 +919,8 @@ class TestProxyInitializationHelpers: ) @patch("subprocess.run") @patch("atexit.register") - @patch("litellm.proxy.db.prisma_client.PrismaManager.setup_database") - @patch( + @patch("litellm.proxy.db.prisma_client.PrismaManager.setup_database") # test-quality-ok: CLI boot test cannot run real prisma migrations, same as sibling boot tests + @patch( # test-quality-ok: CLI boot test cannot run real prisma migrations, same as sibling boot tests "litellm.proxy.db.prisma_client.should_update_prisma_schema", return_value=False ) def test_db_connection_idle_lifetime_forwarded_to_url( @@ -969,10 +969,10 @@ class TestProxyInitializationHelpers: "litellm.proxy.proxy_server": mock_proxy_module, }, ), - patch( + patch( # test-quality-ok: keeps the boot test from binding a real port, same as sibling boot tests "litellm.proxy.proxy_cli.ProxyInitializationHelpers._get_default_unvicorn_init_args" ) as mock_get_args, - patch( + patch( # test-quality-ok: capture point for the assembled URL params, same as sibling boot tests "litellm.proxy.proxy_cli.append_query_params", side_effect=lambda url, params: str(url), ) as mock_append_query_params, diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.ts index 405ec9a01bf..e2103251997 100644 --- a/ui/litellm-dashboard/src/lib/http/schema.d.ts +++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts @@ -24930,6 +24930,12 @@ export interface components { * @description Prisma `connect_timeout` URL param (seconds). Bounds how long the engine waits to establish a new connection before failing. Defaults to Prisma's built-in value when unset. */ database_connect_timeout?: number | null; + /** + * Database Connection Idle Lifetime + * @description Prisma `max_idle_connection_lifetime` URL param (seconds). Connections idle longer than this are closed by the pool before a managed database (RDS, Cloud SQL, Azure) silently drops them, preventing intermittent `Error { kind: Closed }` failures. Set to null to fall back to Prisma's built-in default (300s). + * @default 60 + */ + database_connection_idle_lifetime: number | null; /** * Database Connection Pool Limit * @description default connection pool for prisma client connecting to postgres db