diff --git a/Cargo.lock b/Cargo.lock index 3d139b030..5ee2cec4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5419,9 +5419,9 @@ dependencies = [ [[package]] name = "sd-notify" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b943eadf71d8b69e661330cb0e2656e31040acf21ee7708e2c238a0ec6af2bf4" +checksum = "3e4ef7359e694bfaf1dd27a30f9d760b54c00dfae9f19bd0c05a39bc9128fe76" dependencies = [ "libc", ] diff --git a/Cargo.toml b/Cargo.toml index 5384b7a7a..85a98d891 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -540,7 +540,7 @@ version = "1.13.0" # systemd service status notification [workspace.dependencies.sd-notify] -version = "0.4.5" +version = "0.5.0" # JSON Schema generation [workspace.dependencies.schemars] diff --git a/crates/cli/src/lifecycle.rs b/crates/cli/src/lifecycle.rs index 774c890c1..3da49f9d1 100644 --- a/crates/cli/src/lifecycle.rs +++ b/crates/cli/src/lifecycle.rs @@ -64,7 +64,7 @@ impl Reloadable for Templates { /// A wrapper around [`sd_notify::notify`] that logs any errors fn notify(states: &[sd_notify::NotifyState]) { - if let Err(e) = sd_notify::notify(false, states) { + if let Err(e) = sd_notify::notify(states) { tracing::error!( error = &e as &dyn std::error::Error, "Failed to notify service manager" @@ -133,16 +133,8 @@ impl LifecycleManager { notify(&[sd_notify::NotifyState::Ready]); // This will be `Some` if we have the watchdog enabled, and `None` if not - let mut watchdog_interval = { - let mut watchdog_usec = 0; - if sd_notify::watchdog_enabled(false, &mut watchdog_usec) { - Some(tokio::time::interval(Duration::from_micros( - watchdog_usec / 2, - ))) - } else { - None - } - }; + let mut watchdog_interval = + sd_notify::watchdog_enabled().map(|timeout| tokio::time::interval(timeout / 2)); // Wait for a first shutdown signal and trigger the soft shutdown let likely_crashed = loop {