Skip to content

Commit 64652c3

Browse files
committed
chore: fix format
Signed-off-by: Gavin.Zhu <gavin.z@gmicloud.ai>
1 parent a4acd2c commit 64652c3

File tree

2 files changed

+36
-13
lines changed

2 files changed

+36
-13
lines changed

lib/runtime/src/config.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,18 @@ impl RuntimeConfig {
242242
if let Ok(seconds_str) = std::env::var("DYN_SYSTEM_AUTO_READY_AFTER_SECONDS") {
243243
if !seconds_str.is_empty() {
244244
if let Ok(seconds) = seconds_str.parse::<u64>() {
245-
tracing::info!("Using DYN_SYSTEM_AUTO_READY_AFTER_SECONDS={} for health transition policy", seconds);
246-
config.health_transition_policy = HealthTransitionPolicy::TimeBasedReady { after_seconds: seconds };
245+
tracing::info!(
246+
"Using DYN_SYSTEM_AUTO_READY_AFTER_SECONDS={} for health transition policy",
247+
seconds
248+
);
249+
config.health_transition_policy = HealthTransitionPolicy::TimeBasedReady {
250+
after_seconds: seconds,
251+
};
247252
} else {
248-
tracing::warn!("Invalid value for DYN_SYSTEM_AUTO_READY_AFTER_SECONDS: '{}', expected a number", seconds_str);
253+
tracing::warn!(
254+
"Invalid value for DYN_SYSTEM_AUTO_READY_AFTER_SECONDS: '{}', expected a number",
255+
seconds_str
256+
);
249257
}
250258
}
251259
}

lib/runtime/src/lib.rs

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,27 +143,37 @@ impl SystemHealth {
143143
match &self.health_transition_policy {
144144
HealthTransitionPolicy::Manual => {
145145
// No automatic transition (current behavior)
146-
},
146+
}
147147
HealthTransitionPolicy::TimeBasedReady { after_seconds } => {
148148
if uptime.as_secs() >= *after_seconds {
149-
tracing::info!("Auto-transitioning to ready after {}s uptime (policy: time_based_ready)", uptime.as_secs());
149+
tracing::info!(
150+
"Auto-transitioning to ready after {}s uptime (policy: time_based_ready)",
151+
uptime.as_secs()
152+
);
150153
self.system_health = HealthStatus::Ready;
151154
}
152-
},
155+
}
153156
HealthTransitionPolicy::EndpointBasedReady => {
154157
// Ready when service has registered at least one endpoint
155158
if !self.endpoint_health.is_empty() {
156-
let all_endpoints_ready = self.endpoint_health.values()
159+
let all_endpoints_ready = self
160+
.endpoint_health
161+
.values()
157162
.all(|status| *status == HealthStatus::Ready);
158163

159164
if all_endpoints_ready {
160-
tracing::info!("Auto-transitioning to ready - all {} endpoints are ready (policy: endpoint_based_ready)",
161-
self.endpoint_health.len());
165+
tracing::info!(
166+
"Auto-transitioning to ready - all {} endpoints are ready (policy: endpoint_based_ready)",
167+
self.endpoint_health.len()
168+
);
162169
self.system_health = HealthStatus::Ready;
163170
}
164171
}
165-
},
166-
HealthTransitionPolicy::Custom { auto_ready_after_seconds, require_endpoints_ready } => {
172+
}
173+
HealthTransitionPolicy::Custom {
174+
auto_ready_after_seconds,
175+
require_endpoints_ready,
176+
} => {
167177
let mut ready_conditions_met = true;
168178

169179
// Check time-based condition if specified
@@ -178,7 +188,9 @@ impl SystemHealth {
178188
if self.endpoint_health.is_empty() {
179189
ready_conditions_met = false;
180190
} else {
181-
let all_endpoints_ready = self.endpoint_health.values()
191+
let all_endpoints_ready = self
192+
.endpoint_health
193+
.values()
182194
.all(|status| *status == HealthStatus::Ready);
183195
if !all_endpoints_ready {
184196
ready_conditions_met = false;
@@ -187,7 +199,10 @@ impl SystemHealth {
187199
}
188200

189201
if ready_conditions_met {
190-
tracing::info!("Auto-transitioning to ready after {}s uptime (policy: custom)", uptime.as_secs());
202+
tracing::info!(
203+
"Auto-transitioning to ready after {}s uptime (policy: custom)",
204+
uptime.as_secs()
205+
);
191206
self.system_health = HealthStatus::Ready;
192207
}
193208
}

0 commit comments

Comments
 (0)