Skip to content

Commit

Permalink
refactor: remove unused Sender
Browse files Browse the repository at this point in the history
  • Loading branch information
Mcdostone committed Jan 28, 2025
1 parent 52dc359 commit 18632bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
4 changes: 0 additions & 4 deletions crates/tui/src/component/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
14 changes: 2 additions & 12 deletions crates/tui/src/records_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand All @@ -28,7 +23,6 @@ const BUFFER_SIZE: usize = 120;
/// Wrapper around [CircularBuffer]
pub struct RecordsBuffer {
buffer: CircularBuffer<BUFFER_SIZE, KafkaRecord>,
tx_action: Option<UnboundedSender<Action>>,
read: usize,
pub channels: (Sender<BufferAction>, Receiver<BufferAction>),
last_time_sorted: usize,
Expand Down Expand Up @@ -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<Action>) {
self.tx_action = Some(tx);
}

pub fn is_empty(&self) -> bool {
self.buffer.is_empty()
}
Expand Down

0 comments on commit 18632bf

Please sign in to comment.