This commit is contained in:
parent
5d708bdb82
commit
b6f5c38e4a
5 changed files with 146 additions and 96 deletions
src
15
src/bot.rs
15
src/bot.rs
|
@ -7,6 +7,15 @@ use notify::{Event, EventKind, event::{AccessKind, AccessMode}, RecursiveMode, W
|
|||
use tokio::time::sleep;
|
||||
use systemd_journal_logger::connected_to_journal;
|
||||
|
||||
macro_rules! debug {
|
||||
($msg:tt) => {
|
||||
match connected_to_journal() {
|
||||
true => log::debug!("[DEBUG] {}", $msg),
|
||||
false => println!("[DEBUG] {}", $msg),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! info {
|
||||
($msg:tt) => {
|
||||
match connected_to_journal() {
|
||||
|
@ -76,6 +85,8 @@ impl Bot {
|
|||
};
|
||||
|
||||
lemmy.get_communities().await;
|
||||
|
||||
self.history = SeriesHistory::load_history();
|
||||
|
||||
let start: DateTime<Utc> = Utc::now();
|
||||
while Utc::now() - start <= Duration::minutes(60) {
|
||||
|
@ -84,10 +95,14 @@ impl Bot {
|
|||
let read_copy = self.shared_config.read().expect("Read Lock Failed").clone();
|
||||
for series in read_copy.series {
|
||||
series.update(&mut self.history, &lemmy, &self.shared_config).await;
|
||||
debug!("Done Updating Series");
|
||||
self.wait(1, Wait::Absolute).await;
|
||||
}
|
||||
debug!("Awaiting Timeout");
|
||||
self.wait(30, Wait::Buffer).await;
|
||||
debug!("Pinging Server");
|
||||
self.ping_status().await;
|
||||
debug!("Awaiting Timeout 2");
|
||||
self.wait(30, Wait::Absolute).await;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue