From 19c41eff6b2fcbec5c5afdd76acde3daf885ff6e Mon Sep 17 00:00:00 2001 From: Neshura Date: Fri, 1 Sep 2023 00:18:03 +0200 Subject: [PATCH] Status Ping Bugfix --- src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 56c1d50..ed9fbd0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -256,7 +256,7 @@ impl Bot { return Ok(()); } - pub(crate) fn idle(&self) { + pub(crate) async fn idle(&self) { let mut sleep_duration = chrono::Duration::seconds(30); if Utc::now().naive_local() - self.start_time > sleep_duration { sleep_duration = chrono::Duration::seconds(60); @@ -266,9 +266,9 @@ impl Bot { sleep(time::Duration::from_secs(1)); } - match reqwest::blocking::get( + match reqwest::get( "https://status.neshweb.net/api/push/7s1CjPPzrV?status=up&msg=OK&ping=", - ) { + ).await { Ok(_) => {} Err(err) => println!("{}", err), }; @@ -311,7 +311,7 @@ async fn run_bot(bot: Arc>) { let _ = this.community_ids.load(&this.auth, &this.config.instance).await; loop { - this.idle(); + this.idle().await; println!("Debug A"); // DEBUG match this.run_once(&mut old).await { Ok(_) => {} @@ -319,7 +319,7 @@ async fn run_bot(bot: Arc>) { }; *bot.lock().await = this.clone(); - this.idle(); + this.idle().await; } }