From ac7fdc389e677ee5d65af278de18f294a74cf033 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Thu, 19 Mar 2026 20:22:38 -0700 Subject: [PATCH] =?UTF-8?q?fix(redis):=20fast-fail=20concurrent=20HALF=5FO?= =?UTF-8?q?PEN=20probes=20=E2=80=94=20only=20one=20probe=20at=20a=20time?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- litellm/caching/redis_cache.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/caching/redis_cache.py b/litellm/caching/redis_cache.py index 2dd37d5090d..5379560999d 100644 --- a/litellm/caching/redis_cache.py +++ b/litellm/caching/redis_cache.py @@ -123,10 +123,15 @@ class RedisCircuitBreaker: def is_open(self) -> bool: """Returns True if Redis calls should be skipped.""" + if self._state == self.HALF_OPEN: + # Probe already in flight — fast-fail all concurrent requests. + # Only the one call that caused the OPEN→HALF_OPEN transition + # (which returned False) is the designated probe. + return True if self._state == self.OPEN: if time.time() - (self._opened_at or 0) > self.recovery_timeout: self._state = self.HALF_OPEN - return False # allow probe through + return False # this caller is the designated probe return True return False