Skip to main content

Module concurrency

Module concurrency 

Source
Expand description

Concurrency limiter for backend operations.

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§

ConcurrencyLimiter
Limits concurrent backend operations and tracks in-flight count.
ConcurrencyPermit
RAII guard for a concurrency permit.
Stats
Snapshot of concurrency limiter state.

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.