Debug Logging

This commit is contained in:
Neshura 2023-07-31 19:22:28 +02:00
parent 355040b9a0
commit d31f291e26
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -99,20 +99,25 @@ impl Bot {
#[warn(unused_results)]
pub(crate) fn run_once(&mut self, mut prev_time: NaiveTime) -> bool {
println!("{:#<1$}", "", 30);
self.start_time = Utc::now();
if self.start_time.time() - prev_time > chrono::Duration::seconds(6) { // Prod should use hours, add command line switch later and read duration from config
println!("Reloading Config");
prev_time = self.start_time.time();
self.config.load();
if !self.community_ids.load(&self.auth, &self.config.instance) {return false}; // Return early if community id's cannot be loaded
println!("Done!");
}
// Start the polling process
// Get all feed URLs (use cache)
println!("Checking Feeds");
let post_queue: Vec<CreatePost> = match self.config.check_feeds(&mut self.post_history, &self.community_ids, &self.auth) {
Ok(data) => data,
Err(_) => return false
};
println!("Done!");
post_queue.iter().for_each(|post| {
println!("Posting: {}", post.name);