move systemd stopping notification point

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-04-02 04:12:24 +00:00
parent 45fd3875c8
commit 29d55b8036
2 changed files with 14 additions and 9 deletions

View file

@ -77,6 +77,10 @@ pub(crate) async fn start(server: Arc<Server>) -> Result<Arc<Services>> {
pub(crate) async fn stop(services: Arc<Services>) -> Result<()> {
debug!("Shutting down...");
#[cfg(all(feature = "systemd", target_os = "linux"))]
sd_notify::notify(true, &[sd_notify::NotifyState::Stopping])
.expect("failed to notify systemd of stopping state");
// Wait for all completions before dropping or we'll lose them to the module
// unload and explode.
services.stop().await;