From f37ca5e627987368812e8ab790a5054e5235874d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6lfer?= Date: Fri, 1 Aug 2025 16:21:31 +0200 Subject: [PATCH] Made watchdog less verbose --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 2 +- src/watchdog.rs | 14 ++++++++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18437bb..d7cd72e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2448,7 +2448,7 @@ dependencies = [ [[package]] name = "teachertracker-rs" -version = "0.1.0" +version = "0.1.1" dependencies = [ "chrono", "futures", diff --git a/Cargo.toml b/Cargo.toml index 3262e71..dbc91ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "teachertracker-rs" -version = "0.1.0" +version = "0.1.1" edition = "2024" authors = ["Lukas Wölfer "] description = "A MediaWiki bot that updates score information of teachers" diff --git a/src/main.rs b/src/main.rs index a115bc5..f4f4eb3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,7 @@ use mwbot::{ Bot, generators::{Generator, SortDirection, categories::CategoryMemberSort}, }; -use std::{error::Error, path::Path}; +use std::path::Path; use crate::watchdog::watch_wanted; diff --git a/src/watchdog.rs b/src/watchdog.rs index fedd539..f8d84db 100644 --- a/src/watchdog.rs +++ b/src/watchdog.rs @@ -11,11 +11,17 @@ pub async fn watch_wanted(bot: Bot) -> ! { let _enter = span.enter(); let mut ignored_ids = vec![]; + let mut watch_count = 0; loop { - if ignored_ids.is_empty() { - tracing::info!("Watchdog check..."); - } else { - tracing::info!("Watchdog check [{} failed ids]...", ignored_ids.len()); + watch_count += 1; + if watch_count >= 120 { + watch_count = 0; + let failed_id_info = if ignored_ids.is_empty() { + String::new() + } else { + format!("[{} failed ids]", ignored_ids.len()) + }; + tracing::info!("Watchdog check{failed_id_info}..."); } let wanted = wanted_ids(bot.clone()).await; let mut new_ignored = vec![];