From 5a79f648c6e54cd046588498eb54447195ff55f4 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 4 May 2024 08:48:53 -0700 Subject: [PATCH] fix(caching.py): fix redis caching ping check don't fail to startup. Log an error message. --- litellm/caching.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/litellm/caching.py b/litellm/caching.py index 86e3ef40d11..d7cf033705f 100644 --- a/litellm/caching.py +++ b/litellm/caching.py @@ -177,11 +177,18 @@ class RedisCache(BaseCache): try: # asyncio.get_running_loop().create_task(self.ping()) result = asyncio.get_running_loop().create_task(self.ping()) - except Exception: - pass + except Exception as e: + verbose_logger.error( + "Error connecting to Async Redis client", extra={"error": str(e)} + ) ### SYNC HEALTH PING ### - self.redis_client.ping() + try: + self.redis_client.ping() + except Exception as e: + verbose_logger.error( + "Error connecting to Sync Redis client", extra={"error": str(e)} + ) def init_async_client(self): from ._redis import get_redis_async_client