diff options
Diffstat (limited to 'src/watch/upstream.rs')
| -rw-r--r-- | src/watch/upstream.rs | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/watch/upstream.rs b/src/watch/upstream.rs index c2772a2..507d734 100644 --- a/src/watch/upstream.rs +++ b/src/watch/upstream.rs @@ -1,20 +1,3 @@ -//! The two-stage VCS watcher (§5.2) — the expensive path, made cheap. -//! -//! For a `-git` package the `pkgver=` field is frozen and the real version is -//! computed by `pkgver()` at build time, so detection cannot read it off the -//! recipe. Running the real thing every poll would be absurd, so: -//! -//! **Stage A** asks each upstream where its tip is now (`git ls-remote`, which -//! costs one network round trip and no clone). If the set of tips is identical -//! to the set recorded on the accepted release, *nothing can have changed* and -//! we stop. This is the common case: most days, nothing moves. -//! -//! **Stage B** runs only when Stage A saw movement: clone/fetch into the -//! persistent cache, run `makepkg --vercheck` against the recipe, and read back -//! the computed `epoch:pkgver-pkgrel` — the only correct answer, because -//! `pkgver()` can do arbitrary things. The clone is already there, so this is -//! also where the pins are captured. - use std::collections::BTreeSet; use std::path::PathBuf; use std::process::Command; @@ -148,9 +131,8 @@ impl StageB { } } -/// A process-wide cap on concurrent Stage B resolutions (§5.2 "a global -/// concurrency cap"). Each one clones repositories and runs a chroot-less -/// makepkg; letting twenty run at once would be silly. +/// A process-wide cap on concurrent Stage B resolutions (§5.2). Each one clones +/// repositories and runs a chroot-less makepkg. static RUNNING: AtomicUsize = AtomicUsize::new(0); static SLOT_FREE: Condvar = Condvar::new(); static SLOT_LOCK: Mutex<()> = Mutex::new(()); @@ -205,9 +187,9 @@ pub fn resolve( return Ok(Some(StageB::from_cache(hit))); } - // Per-pkgbase cooldown: even if the tips moved again, we do not re-resolve - // the same pkgbase more than once per cooldown window. The previous answer - // is reused, so a chatty upstream cannot turn detection into a build loop. + // Per-pkgbase cooldown: even if the tips moved again, we do not re-resolve the + // same pkgbase more than once per window, so a chatty upstream cannot turn + // detection into a build loop. let cooldown = db::setting_i64(db, "stage_b_cooldown", 86400); if let Some(recent) = db::stage_b_recent(db, pb.id, cooldown)? { return Ok(Some(StageB::from_cache(recent))); |
