mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
docs(redis): say why async paths cannot reuse redis_connect_func
The AUTH exchange it runs is the blocking client API, so on an async connection send_command and read_response hand back coroutines nobody awaits and the connect fails outright.
This commit is contained in:
parent
cba4fa403d
commit
bfe54eb013
1 changed files with 4 additions and 2 deletions
|
|
@ -577,8 +577,10 @@ def _init_async_redis_sentinel(redis_kwargs) -> async_redis.Redis:
|
|||
|
||||
|
||||
def _async_credential_provider(redis_connect_func: object | None) -> CredentialProvider | None:
|
||||
"""Async redis-py never calls ``redis_connect_func``; it authenticates through a
|
||||
``CredentialProvider``, which it consults per connection so the token refreshes."""
|
||||
"""``redis_connect_func`` runs the AUTH exchange with the blocking client API, so on an
|
||||
async connection its ``send_command``/``read_response`` calls return coroutines nobody
|
||||
awaits and every connect fails. Async paths authenticate through a ``CredentialProvider``
|
||||
instead, which redis-py consults per connection so the token stays fresh."""
|
||||
gcp_service_account: Final = getattr(redis_connect_func, "_gcp_service_account", None)
|
||||
if gcp_service_account is not None:
|
||||
return GCPIAMCredentialProvider(gcp_service_account)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue