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:
2026-05-07 02:32:17 -04:00
parent c53a3620f2
commit 09107bc97b
2 changed files with 13 additions and 6 deletions

View File

@@ -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(())