From 9b0f43893225bf6bd0ae8383748948c9f9109996 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 6 Apr 2026 23:04:07 +0300 Subject: [PATCH] add new debug events; change some levels to info --- src/main.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3bed63a..8150a7d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,15 +33,17 @@ async fn main() { let update = config.update.map(Duration::from_secs); let sleep = config.sleep.map(Duration::from_secs); let mut database = Database::new(&config.database).unwrap(); - let rp = RustyPipe::new(); loop { + info!("begin {} channels update...", config.channel.len()); for (c, channel) in &config.channel { - debug!("handle channel `{c}` ({})...", channel.id); + debug!("get `{c}` ({})...", channel.id); match rp.query().channel_videos(&channel.id).await { Ok(result) => { - for item in result.content.items { + let items = result.content.items; + debug!("received {:?} items to handle...", items.len()); + for item in items { if database.is_processed(&item.id).is_ok_and(|r| r) { debug!( "item `{}` for channel `{c}` already processed; skip handle.", @@ -79,7 +81,7 @@ async fn main() { String::from_utf8_lossy(&response.stdout).contains(s) }) { match database.process(&item.id) { - Ok(()) => debug!( + Ok(()) => info!( "exec `{cmd}` for channel `{c}` successful: `{:?}`", response ), @@ -117,14 +119,14 @@ async fn main() { } match update { Some(duration) => { - debug!( + info!( "queue completed; await {} seconds to continue...", duration.as_secs() ); thread::sleep(duration) } None => { - debug!("all tasks completed; exit."); + info!("all tasks completed; exit."); break; } }