litellm/tests/test_litellm/caching
Yassin Kortam 88c7755283
Some checks are pending
GitHub Actions Security Analysis / zizmor (push) Waiting to run
fix(redis): loop-scope async Lua script registration (#31501)
* fix(redis): loop-scope async Lua script registration

async_register_script registered the Lua script eagerly and returned a
callable bound to the Redis client of the event loop running at
registration time. The v3 parallel request limiter registers its three
scripts once in __init__ at proxy startup and stores them, so a request
or logging callback on another loop awaited a script bound to the startup
loop and hit "got Future attached to a different loop". The limiter then
fell back to a pipeline that reset the window TTL every increment, so
counters never expired and an 80M TPM model rate-limited around 40M.

Defer registration to call time and cache the per-loop executor in
in_memory_llm_clients_cache (which already keys on the running loop), so
each loop runs the script against its own client. Covers all five
consumers of the primitive.

Resolves LIT-3298

* fix(redis): await evalsha on the cluster Lua script path

The cluster branch returned the evalsha coroutine without awaiting it, so
callers received a coroutine instead of the script result. Await it, which
also addresses the cluster path called out in review.
2026-06-27 12:20:40 -07:00
..
test_azure_blob_cache.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_caching.py feat(caching): add valkey-semantic cache backend and fix semantic cache scope keys (#30675) 2026-06-19 17:09:17 -07:00
test_caching_handler.py fix(caching): restore stored prompt_tokens on embedding cache hits instead of recomputing (#30046) 2026-06-10 15:49:20 +05:30
test_check_and_fix_namespace_none_guard.py chore: litellm oss staging160626 (#30527) 2026-06-16 18:23:13 -07:00
test_dual_cache.py feat(rate-limiter): allow opting out of v3 TPM reservation and Redis circuit breaker (#30211) 2026-06-11 10:34:26 -07:00
test_embedding_router.py chore: litellm oss staging 250626 (#31305) 2026-06-25 21:00:28 -07:00
test_gcs_cache.py chore: litellm oss staging (#30745) 2026-06-18 13:55:35 -07:00
test_in_memory_cache.py fix: prune expired in-memory cache heap entries (#25664) 2026-04-14 23:37:49 +05:30
test_llm_caching_handler.py fix: don't close HTTP/SDK clients on LLMClientCache eviction (#22925) 2026-03-05 12:00:38 -08:00
test_llm_client_cache_e2e.py fix: don't close HTTP/SDK clients on LLMClientCache eviction (#22925) 2026-03-05 12:00:38 -08:00
test_qdrant_semantic_cache.py chore: litellm oss staging 250626 (#31305) 2026-06-25 21:00:28 -07:00
test_redis_cache.py fix(redis): loop-scope async Lua script registration (#31501) 2026-06-27 12:20:40 -07:00
test_redis_cluster_cache.py fix(caching): check REDIS_CLUSTER_NODES env var in Cache and Router class selection (#22790) 2026-03-06 17:31:30 -08:00
test_redis_connection_pool.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_redis_semantic_cache.py chore: litellm oss staging 250626 (#31305) 2026-06-25 21:00:28 -07:00
test_s3_cache.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_valkey_semantic_cache.py feat(caching): add valkey-semantic cache backend and fix semantic cache scope keys (#30675) 2026-06-19 17:09:17 -07:00