mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-23 05:02:17 +00:00
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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user