mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-08 06:24:08 +00:00
Merge pull request #3191 from BerriAI/litellm_redis_ssl_kwarg_fix
fix(_redis.py): support redis ssl as a kwarg `REDIS_SSL`
This commit is contained in:
+7
-1
@@ -110,7 +110,7 @@ def _get_redis_client_logic(**env_overrides):
|
||||
redis_kwargs.pop("password", None)
|
||||
elif "host" not in redis_kwargs or redis_kwargs["host"] is None:
|
||||
raise ValueError("Either 'host' or 'url' must be specified for redis.")
|
||||
litellm.print_verbose(f"redis_kwargs: {redis_kwargs}")
|
||||
# litellm.print_verbose(f"redis_kwargs: {redis_kwargs}")
|
||||
return redis_kwargs
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@ def get_redis_async_client(**env_overrides):
|
||||
)
|
||||
)
|
||||
return async_redis.Redis.from_url(**url_kwargs)
|
||||
|
||||
return async_redis.Redis(
|
||||
socket_timeout=5,
|
||||
**redis_kwargs,
|
||||
@@ -154,4 +155,9 @@ def get_redis_connection_pool(**env_overrides):
|
||||
return async_redis.BlockingConnectionPool.from_url(
|
||||
timeout=5, url=redis_kwargs["url"]
|
||||
)
|
||||
connection_class = async_redis.Connection
|
||||
if "ssl" in redis_kwargs and redis_kwargs["ssl"] is not None:
|
||||
connection_class = async_redis.SSLConnection
|
||||
redis_kwargs.pop("ssl", None)
|
||||
redis_kwargs["connection_class"] = connection_class
|
||||
return async_redis.BlockingConnectionPool(timeout=5, **redis_kwargs)
|
||||
|
||||
@@ -7884,6 +7884,8 @@ def exception_type(
|
||||
elif (
|
||||
"429 Quota exceeded" in error_str
|
||||
or "IndexError: list index out of range" in error_str
|
||||
or "429 Unable to submit request because the service is temporarily out of capacity."
|
||||
in error_str
|
||||
):
|
||||
exception_mapping_worked = True
|
||||
raise RateLimitError(
|
||||
|
||||
Reference in New Issue
Block a user