Update litellm/proxy/utils.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
Harshit Jain 2026-02-14 08:46:07 +05:30 committed by GitHub
parent f33a7ca7d6
commit d90f3d558e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2075,11 +2075,8 @@ async def _lookup_deprecated_key(
now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS,
)
return deprecated_row.active_token_id
# Cache negative result to avoid repeated DB lookups for invalid tokens
_deprecated_key_cache[hashed_token] = (
None,
now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS,
)
# Only cache positive results; negative lookups are fast on indexed columns
# and caching them risks evicting real deprecated key entries.
except Exception as e:
verbose_proxy_logger.debug("Deprecated key lookup skipped: %s", e)