Skip to content

Commit

Permalink
Test raw_data retention.
Browse files Browse the repository at this point in the history
  • Loading branch information
thebracket committed Oct 25, 2024
1 parent aed23f8 commit c74dcb5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/rust/lqosd/src/throughput_tracker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ fn throughput_task(
expired_flows.clear();
timer_metrics.apply_flow_data = timer_metrics.start.elapsed().as_secs_f64();
THROUGHPUT_TRACKER.apply_queue_stats(&mut net_json_calc, &mut raw_data);

// Raw Data cleanup time
if let Ok(boot_time) = time_since_boot() {
let time_since_boot = Duration::from(boot_time);
let five_minutes_ago = time_since_boot.saturating_sub(Duration::from_secs(300));
let five_minutes_ago_nanoseconds = five_minutes_ago.as_nanos();
raw_data.retain(|_k, v| v.last_seen > 0 && (v.last_seen as u128) < five_minutes_ago_nanoseconds);
}

std::mem::drop(raw_data);
timer_metrics.apply_queue_stats = timer_metrics.start.elapsed().as_secs_f64();
THROUGHPUT_TRACKER.update_totals();
Expand Down

0 comments on commit c74dcb5

Please sign in to comment.