QoL
* Made todo added responses ephemeral if /settings ephemeral is on * Enabled systemd watchdog * Move metrics to rocket
This commit is contained in:
@@ -4,6 +4,7 @@ use std::env;
|
||||
|
||||
use log::{info, warn};
|
||||
use poise::serenity_prelude::client::Context;
|
||||
use sd_notify::{self, NotifyState};
|
||||
use sqlx::{Executor, MySql};
|
||||
use tokio::{
|
||||
sync::broadcast::Receiver,
|
||||
@@ -33,6 +34,15 @@ async fn _initialize(ctx: Context, pool: impl Executor<'_, Database = Database>
|
||||
.flatten()
|
||||
.unwrap_or(10);
|
||||
|
||||
let mut watchdog_interval = 0;
|
||||
let watchdog = sd_notify::watchdog_enabled(false, &mut watchdog_interval);
|
||||
|
||||
if watchdog {
|
||||
warn!("Watchdog enabled. Don't die!");
|
||||
} else {
|
||||
warn!("No watchdog running")
|
||||
}
|
||||
|
||||
loop {
|
||||
let sleep_to = Instant::now() + Duration::from_secs(remind_interval);
|
||||
let reminders = sender::Reminder::fetch_reminders(pool).await;
|
||||
@@ -46,5 +56,6 @@ async fn _initialize(ctx: Context, pool: impl Executor<'_, Database = Database>
|
||||
}
|
||||
|
||||
sleep_until(sleep_to).await;
|
||||
let _ = sd_notify::notify(false, &[NotifyState::Watchdog]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user