Skip to content

Commit

Permalink
refactor: Simplify /health and /api_version (#4960)
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Murzin <[email protected]>
  • Loading branch information
dima74 authored Aug 9, 2024
1 parent 9e8e214 commit 19687dc
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions torii/src/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,8 @@ pub async fn handle_queries(
.map_err(Into::into)
}

/// Health status
#[derive(serde::Serialize)]
#[non_exhaustive]
pub enum Health {
Healthy,
}

pub async fn handle_health() -> Json<Health> {
Json(Health::Healthy)
pub async fn handle_health() -> &'static str {
"Healthy"
}

#[iroha_futures::telemetry_future]
Expand Down Expand Up @@ -230,17 +223,15 @@ pub mod subscription {

#[iroha_futures::telemetry_future]
#[cfg(feature = "telemetry")]
pub async fn handle_version(state: Arc<State>) -> Json<String> {
pub async fn handle_version(state: Arc<State>) -> String {
use iroha_version::Version;

let state_view = state.view();
let string = state_view
state_view
.latest_block()
.expect("Genesis not applied. Nothing we can do. Solve the issue and rerun.")
.version()
.to_string();

Json(string)
.to_string()
}

#[cfg(feature = "telemetry")]
Expand Down

0 comments on commit 19687dc

Please sign in to comment.