pub(crate) async fn admit_batch(
state: &AppState,
wanted: &[Wanted],
reserve: bool,
) -> Result<(), String>Expand description
May all of wanted start? A batch never stops an agent to make room (a start may stop one idle
agent with no view; five of them stopping five would be a mass stop nobody asked for), and it is
admitted whole or refused whole. Those already running need no room. With reserve the room is
claimed under the same lock as the check, so a start that comes between this and the batch’s own
cannot take it; release_batch gives it back when the batch is done or failed.