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 31, 2025
1 parent 52dc359 commit 3ad0fba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 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
15 changes: 2 additions & 13 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 @@ -60,15 +54,10 @@ impl RecordsBuffer {
read: 0,

Check warning on line 54 in crates/tui/src/records_buffer.rs

View workflow job for this annotation

GitHub Actions / Format

Diff in /home/runner/work/yozefu/yozefu/crates/tui/src/records_buffer.rs
channels: watch::channel(BufferAction::Count((0, 0, 0))),
matched: 0,
last_time_sorted: 0,
tx_action: None,
last_time_sorted: 0
}
}

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 3ad0fba

Please sign in to comment.