diff --git a/rust/agama-lib/src/manager/http_client.rs b/rust/agama-lib/src/manager/http_client.rs index 0a6f424b4d..7b6a2d86eb 100644 --- a/rust/agama-lib/src/manager/http_client.rs +++ b/rust/agama-lib/src/manager/http_client.rs @@ -18,6 +18,15 @@ impl ManagerHTTPClient { pub async fn probe(&self) -> Result<(), ServiceError> { // BaseHTTPClient did not anticipate POST without request body let empty_body: Vec = vec![]; + if let Ok(value) = std::env::var("PROBE_SYNC") { + return if value == "1" { + self.client + .post_void("/manager/probe_sync", &empty_body) + .await + } else { + Ok(()) + }; + } self.client.post_void("/manager/probe", &empty_body).await } } diff --git a/rust/agama-server/src/manager/web.rs b/rust/agama-server/src/manager/web.rs index 8977c4774c..448b9baf6a 100644 --- a/rust/agama-server/src/manager/web.rs +++ b/rust/agama-server/src/manager/web.rs @@ -91,6 +91,7 @@ pub async fn manager_service(dbus: zbus::Connection) -> Result(State(state): State>) -> Result<(), E Ok(()) } +/// Starts the probing process. +#[utoipa::path( + post, + path = "/probe_sync", + context_path = "/api/manager", + responses( + (status = 200, description = "Probing done.") + ) +)] +async fn probe_sync_action(State(state): State>) -> Result<(), Error> { + state.manager.probe().await?; + Ok(()) +} + /// Starts the probing process. #[utoipa::path( post,