mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
fix(healthcheck): do not return true as response if the check if not applicable (#3551)
This commit is contained in:
@ -2,7 +2,8 @@
|
||||
pub struct RouterHealthCheckResponse {
|
||||
pub database: bool,
|
||||
pub redis: bool,
|
||||
pub locker: bool,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub vault: Option<bool>,
|
||||
#[cfg(feature = "olap")]
|
||||
pub analytics: bool,
|
||||
pub outgoing_request: bool,
|
||||
@ -17,4 +18,28 @@ pub struct SchedulerHealthCheckResponse {
|
||||
pub outgoing_request: bool,
|
||||
}
|
||||
|
||||
pub enum HealthState {
|
||||
Running,
|
||||
Error,
|
||||
NotApplicable,
|
||||
}
|
||||
|
||||
impl From<HealthState> for bool {
|
||||
fn from(value: HealthState) -> Self {
|
||||
match value {
|
||||
HealthState::Running => true,
|
||||
HealthState::Error | HealthState::NotApplicable => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl From<HealthState> for Option<bool> {
|
||||
fn from(value: HealthState) -> Self {
|
||||
match value {
|
||||
HealthState::Running => Some(true),
|
||||
HealthState::Error => Some(false),
|
||||
HealthState::NotApplicable => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl common_utils::events::ApiEventMetric for SchedulerHealthCheckResponse {}
|
||||
|
||||
Reference in New Issue
Block a user