From e30ebacfafa1456334ff8f24a857e925ab149916 Mon Sep 17 00:00:00 2001 From: Manuel Mauro Date: Thu, 21 Nov 2024 11:46:35 +0100 Subject: [PATCH] refactor: nit BinMetadata creation --- core/lib/bin_metadata/src/lib.rs | 5 +++++ core/lib/health_check/src/lib.rs | 13 ++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/core/lib/bin_metadata/src/lib.rs b/core/lib/bin_metadata/src/lib.rs index 955198401cf0..d8a5221e4775 100644 --- a/core/lib/bin_metadata/src/lib.rs +++ b/core/lib/bin_metadata/src/lib.rs @@ -9,6 +9,11 @@ pub mod values { include!(concat!(env!("OUT_DIR"), "/metadata_values.rs")); } +pub const BIN_METADATA: BinMetadata = BinMetadata { + rust: RUST_METADATA, + git: GIT_METADATA, +}; + /// Metadata of the compiled binary. #[derive(Debug, Serialize)] pub struct BinMetadata { diff --git a/core/lib/health_check/src/lib.rs b/core/lib/health_check/src/lib.rs index be54c5a2eec2..7dcdb47aa2f9 100644 --- a/core/lib/health_check/src/lib.rs +++ b/core/lib/health_check/src/lib.rs @@ -11,10 +11,7 @@ pub use async_trait::async_trait; use futures::future; use serde::Serialize; use tokio::sync::watch; -use zksync_bin_metadata::{ - values::{GIT_METADATA, RUST_METADATA}, - BinMetadata, -}; +use zksync_bin_metadata::BIN_METADATA; use self::metrics::{CheckResult, METRICS}; use crate::metrics::AppHealthCheckConfig; @@ -241,13 +238,7 @@ impl AppHealthCheck { .map(|health| health.status) .max_by_key(|status| status.priority_for_aggregation()) .unwrap_or(HealthStatus::Ready); - let inner = Health::with_details( - aggregated_status.into(), - BinMetadata { - rust: RUST_METADATA, - git: GIT_METADATA, - }, - ); + let inner = Health::with_details(aggregated_status.into(), BIN_METADATA); let health = AppHealth { inner, components }; if !health.inner.status.is_healthy() {