The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(redis): treat asyncio.TimeoutError as a timeout on Python 3.10
mateo-berricf1f70968156
diff --git a/litellm/caching/redis_cache.py b/litellm/caching/redis_cache.pyindex 4ba548978d9..4264801d051 100644--- a/litellm/caching/redis_cache.py+++ b/litellm/caching/redis_cache.py@@ -317,15 +317,15 @@ def _is_redis_health_failure(exc: BaseException) -> bool:def _redis_timeout_error_types() -> tuple[type, ...]:"""Health failures that are timeouts rather than unambiguous connectivity errors.- ``builtins.TimeoutError`` covers ``asyncio.TimeoutError`` and ``socket.timeout``- (aliases since py3.11 / py3.10). ``redis.exceptions.TimeoutError`` does not subclass- either, so it is listed explicitly.+ ``builtins.TimeoutError`` covers ``socket.timeout`` (an alias since py3.10) and, from+ py3.11, ``asyncio.TimeoutError``; on py3.10 ``asyncio.TimeoutError`` is still its own+ class, so it is listed explicitly. ``redis.exceptions.TimeoutError`` subclasses neither."""try:from redis.exceptions import TimeoutError as RedisTimeoutErrorexcept ImportError:- return (TimeoutError,)- return (RedisTimeoutError, TimeoutError)+ return (TimeoutError, asyncio.TimeoutError)+ return (RedisTimeoutError, TimeoutError, asyncio.TimeoutError)_MAX_EXCEPTION_CAUSE_DEPTH: Final = 20