From: Thomas Lamprecht Date: Fri, 1 Oct 2021 13:27:46 +0000 (+0200) Subject: rest: daemon: sd notify barrier: allow caller to set timeout X-Git-Tag: v2.0.12~37 X-Git-Url: https://git.proxmox.com/?p=proxmox-backup.git;a=commitdiff_plain;h=058b4b97082fe96893669b4ebf2b06c6e55fa4f3 rest: daemon: sd notify barrier: allow caller to set timeout else it's rather to subtle and not a nice interface considering that we only want to have a thin wrapper for sd_notify_barrier.. Signed-off-by: Thomas Lamprecht --- diff --git a/proxmox-rest-server/src/daemon.rs b/proxmox-rest-server/src/daemon.rs index cf4a5532..63c57e2f 100644 --- a/proxmox-rest-server/src/daemon.rs +++ b/proxmox-rest-server/src/daemon.rs @@ -188,7 +188,7 @@ impl Reloader { } // ensure systemd got the message about the new main PID before continuing, else it // will get confused if the new main process sends its READY signal before that - if let Err(e) = systemd_notify_barrier() { + if let Err(e) = systemd_notify_barrier(u64::MAX) { log::error!("failed to wait on systemd-processing: {}", e); } @@ -293,7 +293,7 @@ where if let Err(e) = systemd_notify(SystemdNotify::Reloading) { log::error!("failed to notify systemd about the state change: {}", e); } - if let Err(e) = systemd_notify_barrier() { + if let Err(e) = systemd_notify_barrier(u64::MAX) { log::error!("failed to wait on systemd-processing: {}", e); } @@ -329,8 +329,8 @@ pub enum SystemdNotify { } /// Waits until all previously sent messages with sd_notify are processed -pub fn systemd_notify_barrier() -> Result<(), Error> { - let rc = unsafe { sd_notify_barrier(0, u64::MAX) }; // infinite timeout +pub fn systemd_notify_barrier(timeout: u64) -> Result<(), Error> { + let rc = unsafe { sd_notify_barrier(0, timeout) }; if rc < 0 { bail!( "systemd_notify_barrier failed: {}",