From 4e608c542651579d08154389c0665999db2f7ccb Mon Sep 17 00:00:00 2001 From: milan Date: Thu, 20 Aug 2026 01:05:36 +0000 Subject: [PATCH] fix(proxy): clamp parallel slot TTL override to a positive value Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/proxy/hooks/parallel_request_limiter_v3.py | 2 +- tests/test_litellm/litellm_core_utils/test_litellm_logging.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/hooks/parallel_request_limiter_v3.py b/litellm/proxy/hooks/parallel_request_limiter_v3.py index 071eb07e265..44adcd16a97 100644 --- a/litellm/proxy/hooks/parallel_request_limiter_v3.py +++ b/litellm/proxy/hooks/parallel_request_limiter_v3.py @@ -369,7 +369,7 @@ PROJECT_OTPM_DESCRIPTOR_KEY: Final = "model_per_project_otpm" # considered leaked (worker crashed without any release callback firing) and # pruned. Also the longest request duration the gauge can track: a request # running longer than this stops occupying its slot. -PARALLEL_REQUEST_SLOT_TTL_SECONDS: Final = int(os.getenv("LITELLM_PARALLEL_REQUEST_SLOT_TTL_SECONDS", "3600")) +PARALLEL_REQUEST_SLOT_TTL_SECONDS: Final = max(1, int(os.getenv("LITELLM_PARALLEL_REQUEST_SLOT_TTL_SECONDS", "3600"))) CacheCounterValue: TypeAlias = int | float | str | bytes diff --git a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py index d656210f733..e05dbdefffc 100644 --- a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py +++ b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py @@ -4960,7 +4960,7 @@ def test_pre_call_redacts_and_masks_raw_request(logging_obj): assert "key=*****" in raw_api_base -def _streaming_logging_obj_with_callbacks(callbacks): +def _streaming_logging_obj_with_callbacks(callbacks: list[CustomLogger]): from datetime import datetime obj = LitellmLogging(