From 4304b0f336ddba7b4ec6780795059ff2066d105b Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 17:33:17 +0000 Subject: comments: keep only what the code cannot show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stripped every comment that described what an item does, documented its arguments or fields, or cited the design docs (§n, I-n, m-n, decision n). 2247 comments down to 83. What survives: the section dividers that segment the large modules, the secret-handling warnings, the agent wire-frame directions, and the few notes without which the code they attach to reads as redundant, reorderable, or unsound. --- src/pipeline/dispatch.rs | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'src/pipeline/dispatch.rs') diff --git a/src/pipeline/dispatch.rs b/src/pipeline/dispatch.rs index d9891c2..88f300e 100644 --- a/src/pipeline/dispatch.rs +++ b/src/pipeline/dispatch.rs @@ -8,21 +8,15 @@ use crate::config::Config; use crate::db::{self, builds, Db}; use crate::pipeline::{self, Outcome}; -/// Handle on a running pool. Dropping without `shutdown` leaves the threads -/// running; call `shutdown` to join them cleanly. pub struct Pool { stop: Arc, handles: Vec>, } impl Pool { - /// Start the dispatcher and `max_concurrent_builds` workers. pub fn spawn(cfg: Arc, db: Db) -> Pool { let stop = Arc::new(AtomicBool::new(false)); let workers = cfg.max_concurrent_builds.max(1); - // Bounded at the worker count: the dispatcher must not run ahead and - // lease builds that no worker has picked up yet, because a leased build - // whose worker never starts would sit until its lease expires. let (tx, rx) = bounded::(workers); let mut handles = Vec::new(); @@ -53,9 +47,6 @@ impl Pool { Pool { stop, handles } } - /// Ask the threads to stop and wait for them. A build that is mid-step will - /// finish that step, fail its lease, and be requeued by the next process's - /// reaper — which is the designed behaviour, not a bug to wait out. pub fn shutdown(self) { self.stop.store(true, Ordering::SeqCst); for h in self.handles { @@ -65,8 +56,6 @@ impl Pool { } fn dispatcher(cfg: Arc, db: Db, stop: Arc, tx: Sender) { - // The reaper runs first on every loop, including the first, so "recover from - // a crash" and "notice an expired lease" are the same code path. while !stop.load(Ordering::SeqCst) { dispatch_once(&cfg, &db, &tx); let mut slept = 0u64; @@ -77,8 +66,6 @@ fn dispatcher(cfg: Arc, db: Db, stop: Arc, tx: Sender) -> Vec { let reaped = builds::reap_expired(db).unwrap_or(0); if reaped > 0 { @@ -91,7 +78,6 @@ pub fn dispatch_once(cfg: &Config, db: &Db, tx: &Sender) -> Vec ) .ok(); } - // Blocked builds become eligible again when the blocking package arrives. let _ = builds::requeue_blocked(db); let _ = builds::cancel_superseded(db); @@ -103,17 +89,12 @@ pub fn dispatch_once(cfg: &Config, db: &Db, tx: &Sender) -> Vec let ids = builds::claim_batch(db, &owner, room, cfg.lease_secs).unwrap_or_default(); for id in &ids { if tx.send(id.clone()).is_err() { - // No worker to take it: give the lease back rather than let it - // expire with nobody holding it. let _ = builds::requeue_transient(db, id); } } ids } -/// How many builds may be admitted right now (§8.2 backpressure). A build that -/// cannot fit on disk stays queued rather than filling the filesystem halfway -/// through a compile. pub fn admissible(cfg: &Config, db: &Db) -> usize { let in_flight = builds::in_flight(db).unwrap_or(0) as usize; let slots = cfg.max_concurrent_builds.saturating_sub(in_flight); @@ -127,7 +108,6 @@ pub fn admissible(cfg: &Config, db: &Db) -> usize { slots } -/// Megabytes free on the filesystem holding `path`. pub fn free_disk_mb(path: &std::path::Path) -> u64 { use std::ffi::CString; let c = match CString::new(path.as_os_str().to_string_lossy().as_bytes()) { @@ -137,8 +117,6 @@ pub fn free_disk_mb(path: &std::path::Path) -> u64 { let mut stat: libc::statvfs = unsafe { std::mem::zeroed() }; let rc = unsafe { libc::statvfs(c.as_ptr(), &mut stat) }; if rc != 0 { - // If we cannot find out, do not block the queue over a measurement - // problem; the pipeline's own disk guard is the backstop. return u64::MAX; } let bsize = stat.f_frsize as u64; @@ -155,9 +133,6 @@ fn worker(cfg: Arc, db: Db, rx: crossbeam_channel::Receiver, sto let attempt = builds::get(&db, &id).ok().flatten().map(|b| b.attempt).unwrap_or(1); match pipeline::run(&cfg, &db, &id) { Ok(Outcome::Failed { transient, .. }) => { - // §8.4: transient failures retry with a bounded number of - // attempts; a deterministic failure does not, because it would - // produce the same answer. if transient && attempt < cfg.max_transient_attempts { let _ = builds::requeue_transient(&db, &id); db::audit_system( -- cgit v1.2.3