dragon.ai.inference.llm_proxy.ResponseQueuePool
- class ResponseQueuePool[source]
Bases:
objectBounded pool of reusable, minimal Dragon Queues.
Lazily allocates up to
pool_sizesingle-slot queues (maxsize=1, block_size=2048) and hands them out on demand. When all queues are in use,acquire()awaits until one is returned viarelease()— providing natural backpressure without an external semaphore.Async-safe via
asyncio.Queue.- Parameters:
Methods
__init__([pool_size, block_size])acquire()Return a Dragon Queue from the pool.
release(queue)Return queue to the pool for reuse.
shutdown()Destroy all pooled queues.
Attributes
Number of idle pooled queues ready for immediate reuse.
- async acquire()[source]
Return a Dragon Queue from the pool.
If an idle queue is available it is returned immediately.
If the pool has not yet reached
pool_size, a new queue is created (off the event loop viaasyncio.to_thread).If the pool is exhausted (all queues in use), awaits until a queue is returned via
release().
- Returns:
A Dragon Queue ready for a single get/put cycle.
- Return type:
dragon.native.Queue