Made watchdog less verbose

This commit is contained in:
Lukas Wölfer
2025-08-01 16:21:31 +02:00
parent 7ee8fb23d9
commit f37ca5e627
4 changed files with 13 additions and 7 deletions

2
Cargo.lock generated
View File

@@ -2448,7 +2448,7 @@ dependencies = [
[[package]] [[package]]
name = "teachertracker-rs" name = "teachertracker-rs"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"chrono", "chrono",
"futures", "futures",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "teachertracker-rs" name = "teachertracker-rs"
version = "0.1.0" version = "0.1.1"
edition = "2024" edition = "2024"
authors = ["Lukas Wölfer <coding@thasky.one>"] authors = ["Lukas Wölfer <coding@thasky.one>"]
description = "A MediaWiki bot that updates score information of teachers" description = "A MediaWiki bot that updates score information of teachers"

View File

@@ -17,7 +17,7 @@ use mwbot::{
Bot, Bot,
generators::{Generator, SortDirection, categories::CategoryMemberSort}, generators::{Generator, SortDirection, categories::CategoryMemberSort},
}; };
use std::{error::Error, path::Path}; use std::path::Path;
use crate::watchdog::watch_wanted; use crate::watchdog::watch_wanted;

View File

@@ -11,11 +11,17 @@ pub async fn watch_wanted(bot: Bot) -> ! {
let _enter = span.enter(); let _enter = span.enter();
let mut ignored_ids = vec![]; let mut ignored_ids = vec![];
let mut watch_count = 0;
loop { loop {
if ignored_ids.is_empty() { watch_count += 1;
tracing::info!("Watchdog check..."); if watch_count >= 120 {
} else { watch_count = 0;
tracing::info!("Watchdog check [{} failed ids]...", ignored_ids.len()); 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 wanted = wanted_ids(bot.clone()).await;
let mut new_ignored = vec![]; let mut new_ignored = vec![];