diff options
Diffstat (limited to 'src/watch/detect.rs')
| -rw-r--r-- | src/watch/detect.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/watch/detect.rs b/src/watch/detect.rs index 084052f..55b7543 100644 --- a/src/watch/detect.rs +++ b/src/watch/detect.rs @@ -20,6 +20,8 @@ use crate::watch::mirror::{read_tree, sync_mirror, Sync}; pub enum Outcome { /// Nothing moved at all. NoChange, + /// The subscription is paused: we look at nothing and change nothing. + Paused, /// A new review was opened. Candidate { id: i64, kind: String }, /// The open review was updated in place (I7). @@ -47,6 +49,16 @@ pub struct CheckReport { pub fn check_pkgbase(cfg: &Config, db: &Db, name: &str) -> Result<CheckReport> { let pb = get_pkgbase(db, name)? .ok_or_else(|| crate::error::Error::not_found(format!("pkgbase {name}")))?; + // A paused subscription is not observed at all. Pausing because a package is + // broken must not keep opening reviews nobody is going to act on, and it + // must not keep polling AUR either. The pause lives on the subscription, so + // that is what we consult. + let paused = db::get_subscription(db, name)? + .map(|s| s.state == subscription_state::PAUSED) + .unwrap_or(false); + if paused { + return Ok(CheckReport { pkgbase: name.into(), head: String::new(), outcome: Outcome::Paused }); + } let sync = sync_mirror(cfg, db, name, &pb.aur_url)?; let head = match &sync { Sync::Gone => { |
