From ae060729dca553b3096b429ababace8c136a39c2 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 30 Jun 2020 06:51:35 -0400 Subject: [PATCH] add proxy healthcheck endpoint --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index 6acd9ce..6c59c4b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -97,6 +97,11 @@ fn _debug_request(req: Request) -> BoxFut { Box::new(future::ok(response)) } +fn health_check_response(_req: Request) -> BoxFut { + let response = Response::new(Body::from("healthy")); + Box::new(future::ok(response)) +} + struct RequestDetails { pub request_bytes: Vec, pub speaker: String, @@ -227,6 +232,8 @@ fn main() -> AnyhowResult<()> { speak_proxy(req, remote_addr.clone(), router3, "/speak"), (&Method::POST, "/speak_spectrogram") => speak_proxy(req, remote_addr.clone(), router3, "/speak_spectrogram"), + (&Method::GET, "/proxy_health") => + health_check_response(req), _ => { let forward = router3.get_random_host(); info!("Forwarding to `{}` random host: {}", &forward, req.uri());