Compare commits
2 Commits
fa0093d582
...
ce77590777
| Author | SHA1 | Date | |
|---|---|---|---|
|
ce77590777
|
|||
|
50fc35883d
|
27
src/main.rs
27
src/main.rs
@@ -351,11 +351,18 @@ async fn main() -> Result<(), MainError> {
|
|||||||
|
|
||||||
move || {
|
move || {
|
||||||
loop {
|
loop {
|
||||||
|
tracing::debug!("waiting to send check-in");
|
||||||
|
|
||||||
if watchdog_tx.try_send(()).is_err() {
|
if watchdog_tx.try_send(()).is_err() {
|
||||||
tracing::error!("tokio runtime deadlocked");
|
tracing::error!("tokio runtime deadlocked");
|
||||||
|
|
||||||
vcs_watcher.borrow().par_iter().for_each(|(&guild_id, vcs_in_guild)| {
|
vcs_watcher
|
||||||
if let Some(&voice_channel_id) = vcs_in_guild.get_left_for(&discord_user_id) {
|
.borrow()
|
||||||
|
.par_iter()
|
||||||
|
.for_each(|(&guild_id, vcs_in_guild)| {
|
||||||
|
if let Some(&voice_channel_id) =
|
||||||
|
vcs_in_guild.get_left_for(&discord_user_id)
|
||||||
|
{
|
||||||
let text_channel_id =
|
let text_channel_id =
|
||||||
discord_voice_channel_corresponding_text_channel
|
discord_voice_channel_corresponding_text_channel
|
||||||
.get(&guild_id)
|
.get(&guild_id)
|
||||||
@@ -364,7 +371,8 @@ async fn main() -> Result<(), MainError> {
|
|||||||
})
|
})
|
||||||
.unwrap_or(voice_channel_id);
|
.unwrap_or(voice_channel_id);
|
||||||
|
|
||||||
let _ = futures::executor::block_on(discord_client.create_message(text_channel_id).content("so sorry I died, I'm in purgatory now, I don't like it here.\nbut I will be back in 5-20 minutes (even if it says I'm still there, I'm not currently recording and will be disconnected soon before later reconnecting and announcing recording again)").into_future());
|
tokio::runtime::Runtime::new().unwrap().block_on(discord_client.create_message(text_channel_id).content("so sorry I died, I'm in purgatory now, I don't like it here.\nbut I will be back in 5-20 minutes (even if it says I'm still there, I'm not currently recording and will be disconnected soon before later reconnecting and announcing recording again)").into_future());
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -378,6 +386,8 @@ async fn main() -> Result<(), MainError> {
|
|||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
loop {
|
loop {
|
||||||
|
tracing::debug!("waiting to acknowledge the watchdog");
|
||||||
|
|
||||||
if watchdog_rx.recv().await.is_err() {
|
if watchdog_rx.recv().await.is_err() {
|
||||||
tracing::error!("watchdog died (this should be impossible)");
|
tracing::error!("watchdog died (this should be impossible)");
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
@@ -385,17 +395,6 @@ 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");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
tokio::spawn({
|
tokio::spawn({
|
||||||
let vcs_sender = vcs_sender.clone();
|
let vcs_sender = vcs_sender.clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user