fix(proxy): broadcast the real cache key when deleting keys

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
mateo 2026-08-07 20:20:13 +00:00
parent 52b4037177
commit aa2a60b24c
2 changed files with 3 additions and 10 deletions

View file

@ -4145,11 +4145,8 @@ async def delete_verification_tokens(
raise e
for key in tokens:
user_api_key_cache.delete_cache(key)
# remove hash token from cache
hashed_token = hash_token(cast(str, key))
await _delete_cache_key_object(
hashed_token=hashed_token,
hashed_token=cast(str, key),
user_api_key_cache=user_api_key_cache,
proxy_logging_obj=proxy_logging_obj,
)

View file

@ -15464,11 +15464,7 @@ async def test_delete_verification_tokens_broadcasts_key_eviction(monkeypatch):
monkeypatch.setattr(
"litellm.proxy.management_endpoints.key_management_endpoints._hash_token_if_needed",
lambda token: token,
)
monkeypatch.setattr(
"litellm.proxy.management_endpoints.key_management_endpoints.hash_token",
lambda token: token,
lambda token: "hashed-token-1",
)
monkeypatch.setattr("litellm.proxy.proxy_server.prisma_client", mock_prisma_client)
monkeypatch.setattr(
@ -15477,7 +15473,7 @@ async def test_delete_verification_tokens_broadcasts_key_eviction(monkeypatch):
)
await delete_verification_tokens(
tokens=["hashed-token-1"],
tokens=["sk-token-1"],
user_api_key_cache=MagicMock(),
user_api_key_dict=UserAPIKeyAuth(
user_id="admin-user",