mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-08 08:08:37 +00:00
refactor(caching): import redis exceptions directly in is_redis_scripting_unavailable
Its only caller runs after a Redis call raised, so redis is always installed there, the same as the sibling helpers that import it lazily without a fallback
This commit is contained in:
parent
3227779577
commit
1343f38da9
1 changed files with 2 additions and 4 deletions
|
|
@ -456,10 +456,8 @@ def is_redis_timeout_failure(exc: BaseException) -> bool:
|
|||
def is_redis_scripting_unavailable(exc: BaseException) -> bool:
|
||||
"""True when Redis refused to run a Lua script for this client: an ACL without
|
||||
``@scripting``, or ``EVAL`` renamed away."""
|
||||
try:
|
||||
from redis.exceptions import NoPermissionError, ResponseError
|
||||
except ImportError:
|
||||
return False
|
||||
from redis.exceptions import NoPermissionError, ResponseError
|
||||
|
||||
if isinstance(exc, NoPermissionError):
|
||||
return "permissions to run" in str(exc)
|
||||
return isinstance(exc, ResponseError) and "unknown command" in str(exc).lower()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue