summaryrefslogtreecommitdiffstats
path: root/src/watch/scheduler.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-22 10:36:24 +0000
committeraur-build <aur-build@localhost>2026-11-22 10:36:24 +0000
commit3dc71b2f5160ef9bd46143eed0edb5d2557b58e6 (patch)
tree7cc7169181b4bdd73fd8817f8c1d7cce6e6998a8 /src/watch/scheduler.rs
parent9dc9087d89891c6e5ef7e5dc084dd13c8611843e (diff)
downloadaur-build-3dc71b2f5160ef9bd46143eed0edb5d2557b58e6.tar.gz
aur-build-3dc71b2f5160ef9bd46143eed0edb5d2557b58e6.zip
rustfmt,lints: pin the formatting, adopt the idiom lints, pay them off
rustfmt.toml fixes the shape the tree is written in (120 columns, small items kept on one line) and one canonical pass makes it the truth. [lints.clippy] names the idiom lints worth enforcing and leaves out the two that would add doc-comment boilerplate rather than remove it. The tree pays them off here: write!/writeln! instead of push_str(&format!()), let-else instead of match-on-Option, borrows where a thread entry point only reads what it owns, no `&self` on a Copy state and no `self` nobody reads. ops::to_prometheus gains one gauge helper: a metric's HELP, TYPE and value are now emitted by the same call instead of three.
Diffstat (limited to 'src/watch/scheduler.rs')
-rw-r--r--src/watch/scheduler.rs16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/watch/scheduler.rs b/src/watch/scheduler.rs
index 4508a03..5aae7ea 100644
--- a/src/watch/scheduler.rs
+++ b/src/watch/scheduler.rs
@@ -27,17 +27,12 @@ pub fn spawn_scheduler(cfg: Arc<Config>, db: Db, stop: Arc<AtomicBool>) -> JoinH
pub fn sweep(cfg: &Config, db: &Db) -> usize {
let now = crate::time::now();
- let due = match db::due_subscriptions(db, &now) {
- Ok(d) => d,
- Err(_) => return 0,
- };
+ let Ok(due) = db::due_subscriptions(db, &now) else { return 0 };
let mut n = 0;
for sub in due {
// Mark it checked first so a slow or hanging source cannot make the
// scheduler re-enter it on the next tick.
- let interval = sub
- .poll_interval_secs
- .unwrap_or(crate::db::setting_i64(db, "poll_interval", 86400));
+ let interval = sub.poll_interval_secs.unwrap_or(crate::db::setting_i64(db, "poll_interval", 86400));
let _ = db::note_check(&db.writer, &sub.pkgbase, &crate::time::secs_ahead(interval), None);
match check_pkgbase(cfg, db, &sub.pkgbase) {
Ok(report) => {
@@ -51,12 +46,7 @@ pub fn sweep(cfg: &Config, db: &Db) -> usize {
}
}
Err(e) => {
- let _ = db::note_check(
- &db.writer,
- &sub.pkgbase,
- &crate::time::secs_ahead(600),
- Some(&e.to_string()),
- );
+ let _ = db::note_check(&db.writer, &sub.pkgbase, &crate::time::secs_ahead(600), Some(&e.to_string()));
}
}
n += 1;