Unverified Commit b1286e7f authored by Biswa Panda's avatar Biswa Panda Committed by GitHub
Browse files

fix: health check endpoint (#4522)

parent f05f7629
...@@ -85,13 +85,15 @@ impl SharedHttpServer { ...@@ -85,13 +85,15 @@ impl SharedHttpServer {
notify: Arc::new(Notify::new()), notify: Arc::new(Notify::new()),
}); });
// Set health status // Insert handler FIRST to ensure it's ready to receive requests
let subject_clone = subject.clone();
self.handlers.insert(subject, handler);
// THEN set health status to Ready (after handler is registered and ready)
system_health system_health
.lock() .lock()
.set_endpoint_health_status(&endpoint_name, HealthStatus::Ready); .set_endpoint_health_status(&endpoint_name, HealthStatus::Ready);
let subject_clone = subject.clone();
self.handlers.insert(subject, handler);
tracing::debug!("Registered endpoint handler for subject: {}", subject_clone); tracing::debug!("Registered endpoint handler for subject: {}", subject_clone);
Ok(()) Ok(())
} }
......
...@@ -77,13 +77,19 @@ impl SharedTcpServer { ...@@ -77,13 +77,19 @@ impl SharedTcpServer {
namespace, namespace,
component_name, component_name,
endpoint_name: endpoint_name.clone(), endpoint_name: endpoint_name.clone(),
system_health, system_health: system_health.clone(),
inflight: Arc::new(AtomicU64::new(0)), inflight: Arc::new(AtomicU64::new(0)),
notify: Arc::new(Notify::new()), notify: Arc::new(Notify::new()),
}); });
// Insert handler FIRST to ensure it's ready to receive requests
self.handlers.insert(endpoint_path, handler); self.handlers.insert(endpoint_path, handler);
// THEN set health status to Ready (after handler is registered and ready)
system_health
.lock()
.set_endpoint_health_status(&endpoint_name, crate::HealthStatus::Ready);
tracing::info!( tracing::info!(
"Registered endpoint '{}' with shared TCP server on {}", "Registered endpoint '{}' with shared TCP server on {}",
endpoint_name, endpoint_name,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment