Expand description
Concurrency limits and task execution helpers.
Limiter and PriorityLimiter provide FIFO and high-priority admission,
with configurable wait timeouts and queue limits. Both return Permit,
which can keep capacity held for a payload stream.
ConcurrencyLimiter caps the number of in-flight backend operations
using a tokio semaphore. Each acquired ConcurrencyPermit notifies
waiters on drop, allowing ConcurrencyLimiter::wait_all to resolve once
all permits have been returned.
run_metered runs an isolated task and waits for its result, while
spawn_metered starts the same task without waiting. Both provide panic
recovery and service.task.* metric emission.
Structs§
- Concurrency
Limiter - Limits concurrent backend operations and tracks in-flight count.
- Concurrency
Permit - RAII guard for a concurrency permit.
- Limiter
- Limits concurrent operations with FIFO queuing and a configurable wait timeout.
- Limiter
Stats - Snapshot of permits in use by a simple limiter.
- Permit
- Owned permit, released on drop.
- Priority
Limiter - Limits concurrent operations with high-priority admission and FIFO within each priority.
- Priority
Limiter Stats - Snapshot of permits in use and queued acquisitions by priority.
- Stats
- Snapshot of concurrency limiter state.
Enums§
- Priority
- Priority for an acquisition from
PriorityLimiter.
Functions§
- run_
metered - Runs a future on a dedicated task with panic isolation and timing metrics.
- spawn_
metered - Spawns a metered future without waiting for its result.