pub(crate) async fn fan_out<I, T, F, Fut>(
items: Vec<(String, I)>,
deadline: Duration,
max_concurrency: usize,
op: F,
) -> Vec<(String, FanOut<T>)>Expand description
Run op for each (id, input) under a concurrency cap and a per-item
deadline, returning outcomes paired with their id in the input order.
No input id is ever dropped: a task that panics is reported as Failed.
This backs SPEC-0014 R33 (per-workspace deadline) and R37 (failures surfaced,
never silently removed). It is generic over the op so the timeout/concurrency
behavior is unit-tested with injected futures — no real store required.
Input ids must be unique: outcomes are keyed by id, so duplicate ids collide.