From 18632bfb6bbb87b6b0ba43694d279a72a457a571 Mon Sep 17 00:00:00 2001 From: Yann Prono Date: Tue, 28 Jan 2025 22:21:05 +0100 Subject: [PATCH] refactor: remove unused `Sender` --- crates/tui/src/component/ui.rs | 4 ---- crates/tui/src/records_buffer.rs | 14 ++------------ 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/crates/tui/src/component/ui.rs b/crates/tui/src/component/ui.rs index b26c21c..f2a8d05 100644 --- a/crates/tui/src/component/ui.rs +++ b/crates/tui/src/component/ui.rs @@ -278,10 +278,6 @@ impl Ui { self.load_topics(action_tx.clone())?; let mut tui = tui::Tui::new()?; tui.enter()?; - self.records - .lock() - .unwrap() - .register_action_handler(action_tx.clone()); self.root.register_action_handler(action_tx.clone())?; self.root.init()?; if !topics.is_empty() { diff --git a/crates/tui/src/records_buffer.rs b/crates/tui/src/records_buffer.rs index e1e22ac..1ee3ccf 100644 --- a/crates/tui/src/records_buffer.rs +++ b/crates/tui/src/records_buffer.rs @@ -10,12 +10,7 @@ use lib::{ KafkaRecord, }; use rayon::prelude::*; -use tokio::sync::{ - mpsc::UnboundedSender, - watch::{self, Receiver, Sender}, -}; - -use crate::action::Action; +use tokio::sync::watch::{self, Receiver, Sender}; /// Size of the ring buffer #[cfg(not(target_family = "windows"))] @@ -28,7 +23,6 @@ const BUFFER_SIZE: usize = 120; /// Wrapper around [CircularBuffer] pub struct RecordsBuffer { buffer: CircularBuffer, - tx_action: Option>, read: usize, pub channels: (Sender, Receiver), last_time_sorted: usize, @@ -61,14 +55,10 @@ impl RecordsBuffer { channels: watch::channel(BufferAction::Count((0, 0, 0))), matched: 0, last_time_sorted: 0, - tx_action: None, + //tx_action: None, } } - pub fn register_action_handler(&mut self, tx: UnboundedSender) { - self.tx_action = Some(tx); - } - pub fn is_empty(&self) -> bool { self.buffer.is_empty() }