From 865fecd694ba06dfb7074211cbdb2c57a91f2657 Mon Sep 17 00:00:00 2001 From: electria Date: Sun, 16 Aug 2026 10:18:24 -0700 Subject: [PATCH] refactor: clear cache in Graph::update --- src/app/graph.rs | 2 ++ src/app/mod.rs | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/graph.rs b/src/app/graph.rs index cdbd212..5b93a80 100644 --- a/src/app/graph.rs +++ b/src/app/graph.rs @@ -30,6 +30,8 @@ impl Graph { if self.timeline.len() > 500 { self.timeline.pop_front(); } + + self.cache.clear(); } } diff --git a/src/app/mod.rs b/src/app/mod.rs index 600c93f..68197fa 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -48,15 +48,12 @@ impl State { match message { Message::Info(snapshot) => { self.total_cpu_graph.update(snapshot.cpu_total); - self.total_cpu_graph.cache.clear(); self.memory_graph .update(snapshot.memory as f32 / snapshot.memory_total as f32 * 100.); - self.memory_graph.cache.clear(); self.swap_graph .update(snapshot.swap as f32 / snapshot.swap_total as f32 * 100.); - self.swap_graph.cache.clear(); if self.cpu_graphs.len() != snapshot.cpus.len() { self.cpu_graphs = snapshot @@ -68,7 +65,6 @@ impl State { for (graph, value) in self.cpu_graphs.iter_mut().zip(snapshot.cpus.into_iter()) { graph.update(value); - graph.cache.clear(); } } }