fix(caching.py): fix async redis health check

This commit is contained in:
Krrish Dholakia 2024-07-06 09:14:29 -07:00
parent 0a99aa6434
commit a79cb33960
3 changed files with 22 additions and 7 deletions

View file

@ -248,9 +248,15 @@ class RedisCache(BaseCache):
# asyncio.get_running_loop().create_task(self.ping())
result = asyncio.get_running_loop().create_task(self.ping())
except Exception as e:
verbose_logger.error(
"Error connecting to Async Redis client", extra={"error": str(e)}
)
if "no running event loop" in str(e):
verbose_logger.debug(
"Ignoring async redis ping. No running event loop."
)
else:
verbose_logger.error(
"Error connecting to Async Redis client - {}".format(str(e)),
extra={"error": str(e)},
)
### SYNC HEALTH PING ###
try: