diff --git a/hive-jobq/src/scheduler.rs b/hive-jobq/src/scheduler.rs index b6fc8883..0fe62cd4 100644 --- a/hive-jobq/src/scheduler.rs +++ b/hive-jobq/src/scheduler.rs @@ -125,12 +125,17 @@ impl Scheduler { owned_reqs.push((name, count)); } } - // Owned units are all-or-nothing; borrow slots were all confirmed free - // above, so this is the only fallible step. Nothing mutated until here. - let Some(guard) = self.resources.acquire(owned_reqs) else { - return false; - }; - self.owned.entry(id).or_default().push(guard); + // Owned units (if any) are all-or-nothing; borrow slots were all + // confirmed free above, so acquiring them is the only fallible step. + // Nothing is mutated until here. Skip the acquire + guard entirely when + // every dep was re-entrant (no owned units): an empty guard would just + // be a no-op `Drop` plus a wasted `owned` entry. + if !owned_reqs.is_empty() { + let Some(guard) = self.resources.acquire(owned_reqs) else { + return false; + }; + self.owned.entry(id).or_default().push(guard); + } for slot in borrows { self.borrow_slots.insert(slot, id); }