mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
test(proxy): clear failed-login TTLs when resetting the throttle between tests
Some checks failed
LiteLLM Rust / rustfmt, clippy, test (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Some checks failed
LiteLLM Rust / rustfmt, clippy, test (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
This commit is contained in:
parent
52f3ff13f0
commit
a39efb1a1d
1 changed files with 11 additions and 4 deletions
|
|
@ -527,10 +527,17 @@ def reset_login_throttle(monkeypatch):
|
|||
|
||||
def _drop_throttle_keys() -> None:
|
||||
in_memory = getattr(_FAILED_LOGIN_CACHE, "in_memory_cache", None)
|
||||
cache_dict = getattr(in_memory, "cache_dict", None)
|
||||
if isinstance(cache_dict, dict):
|
||||
for key in [k for k in cache_dict if str(k).startswith(_CACHE_KEY_PREFIX)]:
|
||||
cache_dict.pop(key, None)
|
||||
if in_memory is None:
|
||||
return
|
||||
tracked = tuple(
|
||||
key
|
||||
for store in (getattr(in_memory, "cache_dict", None), getattr(in_memory, "ttl_dict", None))
|
||||
if isinstance(store, dict)
|
||||
for key in tuple(store)
|
||||
if str(key).startswith(_CACHE_KEY_PREFIX)
|
||||
)
|
||||
for key in tracked:
|
||||
in_memory.delete_cache(key)
|
||||
|
||||
monkeypatch.setattr(ps, "redis_usage_cache", None)
|
||||
_drop_throttle_keys()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue