chore: add a watchdog task that tells me if the process is still running while I debug why the bot dies sometimes without existing
This commit is contained in:
@@ -68,11 +68,7 @@ songbird = { version = "0.6.0", default-features = false, features = [
|
||||
] }
|
||||
strum = { version = "0.28.0", features = ["derive"] }
|
||||
time = "0.3.47"
|
||||
tokio = { version = "1.46.0", features = [
|
||||
"rt-multi-thread",
|
||||
"macros",
|
||||
"signal",
|
||||
] }
|
||||
tokio = { version = "1.46.0", features = ["rt-multi-thread", "macros", "signal", "time"] }
|
||||
tokio-util = { version = "0.7.18", features = ["io"] }
|
||||
tokio-websockets-0-13 = { package = "tokio-websockets", version = "0.13", features = [
|
||||
"rustls-webpki-roots",
|
||||
|
||||
13
src/main.rs
13
src/main.rs
@@ -10,7 +10,7 @@ use songbird::{
|
||||
driver::{Channels, DecodeConfig, SampleRate},
|
||||
shards::TwilightMap,
|
||||
};
|
||||
use std::{collections::BTreeMap, fmt::Debug, str::FromStr, sync::Arc};
|
||||
use std::{collections::BTreeMap, fmt::Debug, str::FromStr, sync::Arc, time::Duration};
|
||||
use strum::EnumString;
|
||||
use tokio::{select, signal::ctrl_c, task::JoinSet};
|
||||
use tokio_util::{sync::CancellationToken, time::FutureExt as _};
|
||||
@@ -416,6 +416,17 @@ async fn main() -> Result<(), MainError> {
|
||||
}
|
||||
});
|
||||
|
||||
tokio::spawn(async {
|
||||
let duration = Duration::from_secs(120);
|
||||
let mut interval = tokio::time::interval(duration);
|
||||
|
||||
loop {
|
||||
interval.tick().await;
|
||||
|
||||
tracing::debug!("this process is still alive");
|
||||
}
|
||||
});
|
||||
|
||||
select! {
|
||||
_ = &mut run_shards => {
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user