Status Ping Bugfix
This commit is contained in:
parent
dd1fbb77c6
commit
19c41eff6b
1 changed files with 5 additions and 5 deletions
10
src/main.rs
10
src/main.rs
|
@ -256,7 +256,7 @@ impl Bot {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn idle(&self) {
|
pub(crate) async fn idle(&self) {
|
||||||
let mut sleep_duration = chrono::Duration::seconds(30);
|
let mut sleep_duration = chrono::Duration::seconds(30);
|
||||||
if Utc::now().naive_local() - self.start_time > sleep_duration {
|
if Utc::now().naive_local() - self.start_time > sleep_duration {
|
||||||
sleep_duration = chrono::Duration::seconds(60);
|
sleep_duration = chrono::Duration::seconds(60);
|
||||||
|
@ -266,9 +266,9 @@ impl Bot {
|
||||||
sleep(time::Duration::from_secs(1));
|
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=",
|
"https://status.neshweb.net/api/push/7s1CjPPzrV?status=up&msg=OK&ping=",
|
||||||
) {
|
).await {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(err) => println!("{}", err),
|
Err(err) => println!("{}", err),
|
||||||
};
|
};
|
||||||
|
@ -311,7 +311,7 @@ async fn run_bot(bot: Arc<Mutex<Bot>>) {
|
||||||
let _ = this.community_ids.load(&this.auth, &this.config.instance).await;
|
let _ = this.community_ids.load(&this.auth, &this.config.instance).await;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
this.idle();
|
this.idle().await;
|
||||||
println!("Debug A"); // DEBUG
|
println!("Debug A"); // DEBUG
|
||||||
match this.run_once(&mut old).await {
|
match this.run_once(&mut old).await {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
|
@ -319,7 +319,7 @@ async fn run_bot(bot: Arc<Mutex<Bot>>) {
|
||||||
};
|
};
|
||||||
*bot.lock().await = this.clone();
|
*bot.lock().await = this.clone();
|
||||||
|
|
||||||
this.idle();
|
this.idle().await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue