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:
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