Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test_queue_flush_limit

Ishaan Jaffer9ce7871d8a43
diff --git a/tests/test_litellm/proxy/db/db_transaction_queue/test_base_update_queue.py b/tests/test_litellm/proxy/db/db_transaction_queue/test_base_update_queue.py
index e1d4cb0541d..6ab5a4a4600 100644
--- a/tests/test_litellm/proxy/db/db_transaction_queue/test_base_update_queue.py
+++ b/tests/test_litellm/proxy/db/db_transaction_queue/test_base_update_queue.py
@@ -21,8 +21,11 @@ async def test_queue_flush_limit():
"""
# Arrange
queue = BaseUpdateQueue()
- # Add more items than the max flush count
+ # Override maxsize so the queue can hold all test items without blocking.
+ # The default LITELLM_ASYNCIO_QUEUE_MAXSIZE (1000) equals MAX_IN_MEMORY_QUEUE_FLUSH_COUNT,
+ # so adding more items than that would cause `await queue.put()` to block forever.
items_to_add = MAX_IN_MEMORY_QUEUE_FLUSH_COUNT + 100
+ queue.update_queue = asyncio.Queue(maxsize=items_to_add + 1)
for i in range(items_to_add):
await queue.add_update(f"test_update_{i}")