Watch
0
0
Fork
You've already forked hyperhive
0

pin the declared closure once per rebuild and seed the marker from the running closure

This commit is contained in:
atlas 2026-11-02 00:42:45 +01:00 • committed by mara
commit 4356f3840c

View file

@ -1560,3 +1560,23 @@ fn a_rebuild_is_live_for_its_own_agent_only() {
);
assert!(!q.rebuild_live("bob"));
}
/// Agents whose running closure differs from the declaration are rebuilt in one
/// sweep. Each rebuild's window holds a build slot, so `buildSlots` caps how
/// many swap at once, however many agents the sweep rebuilds.
#[test]
fn a_sweep_of_rebuilds_holds_one_build_slot_per_agent_window() {
let q = JobQueue::new(1);
let agents: Vec<String> = ["alice", "bob", "carol"].map(str::to_owned).to_vec();
insert(&q, |builder| {
crate::workers::auto_update::boot_nodes(builder, &agents, Vec::new());
});
assert_eq!(
declared_resources_of_kind(&q, "agent_window")
.iter()
.filter(|r| r.contains(&Resource::BuildSlot))
.count(),
3,
"every window declares the build slot"
);
}