mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-20 00:11:50 +00:00
fix: degrade gracefully when cache init fails instead of crashing proxy
This commit is contained in:
parent
8ed7aa52ae
commit
9668fae1a1
1 changed files with 12 additions and 4 deletions
|
|
@ -3130,11 +3130,19 @@ class ProxyConfig:
|
|||
cache_params[key] = get_secret(value)
|
||||
|
||||
## to pass a complete url, or set ssl=True, etc. just set it as `os.environ[REDIS_URL] = <your-redis-url>`, _redis.py checks for REDIS specific environment variables
|
||||
self._init_cache(cache_params=cache_params)
|
||||
if litellm.cache is not None:
|
||||
verbose_proxy_logger.debug(
|
||||
f"{blue_color_code}Set Cache on LiteLLM Proxy{reset_color_code}"
|
||||
try:
|
||||
self._init_cache(cache_params=cache_params)
|
||||
if litellm.cache is not None:
|
||||
verbose_proxy_logger.debug(
|
||||
f"{blue_color_code}Set Cache on LiteLLM Proxy{reset_color_code}"
|
||||
)
|
||||
except Exception as e:
|
||||
verbose_proxy_logger.warning(
|
||||
f"Cache initialisation failed - proxy will start without caching. "
|
||||
f"Error: {e}. "
|
||||
"Fix your cache configuration and restart the proxy to enable caching."
|
||||
)
|
||||
litellm.cache = None
|
||||
elif key == "cache" and value is False:
|
||||
pass
|
||||
elif key == "guardrails":
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue