- update: health check status output to health log
This commit is contained in:
@@ -23,7 +23,7 @@ use tracing::{debug, error, info, warn};
|
|||||||
use utils::service_discovery;
|
use utils::service_discovery;
|
||||||
|
|
||||||
pub(crate) async fn handle_accept_req(stream: &mut TcpStream, packet: Packet) -> Result<(), Box<dyn Error + Send + Sync>> {
|
pub(crate) async fn handle_accept_req(stream: &mut TcpStream, packet: Packet) -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||||
let request = CliAcceptReq::decode(packet.payload.as_slice());
|
// let request = CliAcceptReq::decode(packet.payload.as_slice());
|
||||||
|
|
||||||
// We need to do reply to this packet
|
// We need to do reply to this packet
|
||||||
let data = SrvAcceptReply { result: srv_accept_reply::Result::Accepted, rand_value: 0 };
|
let data = SrvAcceptReply { result: srv_accept_reply::Result::Accepted, rand_value: 0 };
|
||||||
|
|||||||
@@ -86,8 +86,10 @@ pub async fn start_health_check(service_address: &str) -> Result<(), Box<dyn std
|
|||||||
let health_check_endpoint_addr = format!("{}:{}", service_address, health_port);
|
let health_check_endpoint_addr = format!("{}:{}", service_address, health_port);
|
||||||
|
|
||||||
// Start health-check endpoint
|
// Start health-check endpoint
|
||||||
|
let log = warp::log("health_check");
|
||||||
let health_route = warp::path!("health")
|
let health_route = warp::path!("health")
|
||||||
.map(|| warp::reply::with_status("OK", warp::http::StatusCode::OK));
|
.map(|| warp::reply::with_status("OK", warp::http::StatusCode::OK))
|
||||||
|
.with(log);
|
||||||
|
|
||||||
tokio::spawn(warp::serve(health_route).run(health_check_endpoint_addr.to_socket_addrs()?.next().unwrap()));
|
tokio::spawn(warp::serve(health_route).run(health_check_endpoint_addr.to_socket_addrs()?.next().unwrap()));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user