Bulkhead sync
π€ AI-Generated Content
This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.
provide.foundation.resilience.bulkhead_sync
¶
Classes¶
SyncResourcePool
¶
Synchronous resource pool with limited capacity for isolation.
Thread-safe implementation using threading.Lock and threading.Event. For async contexts, use AsyncResourcePool instead.
Functions¶
__attrs_post_init__
¶
acquire
¶
Acquire a resource slot (blocking).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float | None
|
Maximum time to wait (defaults to pool timeout) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if acquired, False if timeout |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If queue is full |
Source code in provide/foundation/resilience/bulkhead_sync.py
active_count
¶
available_capacity
¶
get_stats
¶
Get pool statistics.
Source code in provide/foundation/resilience/bulkhead_sync.py
queue_size
¶
release
¶
Release a resource slot.