refactor: Simplify Redis RPS extraction using let-chains in monitoring_impl.rs

- Replace nested if-let statements with let-chain pattern for Redis RPS parsing
- Update module reference from monitoring to monitoring_impl in monitoring.rs
This commit is contained in:
nutcas3
2026-05-01 00:43:41 +03:00
parent 220b7e0380
commit 11065b827b
2 changed files with 5 additions and 7 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
pub mod sync;
pub mod types;
pub mod monitoring;
pub mod monitoring_impl;
@@ -37,13 +37,11 @@ impl crate::charging::ChargingEngine {
let info: String = redis::cmd("INFO").query_async(&mut conn).await.unwrap_or_default();
for line in info.lines() {
if line.starts_with("instantaneous_ops_per_sec:") {
if let Some(rps_str) = line.split(':').nth(1) {
if let Ok(rps) = rps_str.parse::<f64>() {
return Ok(rps);
}
if line.starts_with("instantaneous_ops_per_sec:")
&& let Some(rps_str) = line.split(':').nth(1)
&& let Ok(rps) = rps_str.parse::<f64>() {
return Ok(rps);
}
}
}
let total_commands = self.extract_metric(&info, "total_commands_processed");