mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
refactor(redis): improve documentation for GCPIAMCredentialProvider class
Updated the docstring for the GCPIAMCredentialProvider class to clarify its purpose and the caching mechanism for GCP IAM tokens. The changes enhance readability and maintainability by providing a more concise explanation of the token caching strategy and its benefits for Redis authentication.
This commit is contained in:
parent
3c0ba0e835
commit
fbf1846b4d
1 changed files with 6 additions and 9 deletions
|
|
@ -80,16 +80,13 @@ def _get_cached_gcp_iam_token(service_account: str) -> str:
|
|||
|
||||
class GCPIAMCredentialProvider(CredentialProvider):
|
||||
"""
|
||||
redis.credentials.CredentialProvider implementation that generates a fresh GCP IAM
|
||||
token on every new connection. This fixes the 1-hour token expiry issue for async
|
||||
Redis cluster clients, which previously generated the token once at startup and
|
||||
cached it as a static password.
|
||||
redis.credentials.CredentialProvider implementation that supplies GCP IAM tokens
|
||||
for Redis authentication, with module-level caching per service account.
|
||||
|
||||
Tokens are cached at module level per service account for
|
||||
_GCP_IAM_TOKEN_TTL_SECONDS (55 min) so that repeated connection
|
||||
establishments — e.g. during connection pool warm-up or health checks —
|
||||
do not each trigger a synchronous network round-trip that would block
|
||||
Python's async event loop and cause cascading request latency.
|
||||
Tokens are cached for _GCP_IAM_TOKEN_TTL_SECONDS (55 min) so that repeated
|
||||
connection establishments — e.g. during connection pool warm-up or health checks —
|
||||
do not each trigger a synchronous network round-trip that would block Python's
|
||||
async event loop and cause cascading request latency.
|
||||
"""
|
||||
|
||||
def __init__(self, gcp_service_account: str) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue