Skip to content

Commit

Permalink
fix: feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanaden committed Jun 26, 2024
1 parent 2f1ade3 commit b8685ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ crossterm = { version = "0.27", features = ["event-stream"] }
ratatui = { version = "0.26", features = ["serde"] }
tui-input = "0.8"
tui-tree-widget = "0.20"
throbber-widgets-tui = "0.5.0"

# Config for 'cargo dist'
[workspace.metadata.dist]
Expand Down
3 changes: 2 additions & 1 deletion rm-main/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ crossterm.workspace = true
ratatui.workspace = true
tui-input.workspace = true
tui-tree-widget.workspace = true
throbber-widgets-tui = "0.5.0"
throbber-widgets-tui.workspace = true

16 changes: 4 additions & 12 deletions rm-main/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ impl App {
let (tick_tx, tick_rx) = mpsc::unbounded_channel();

tokio::spawn(transmission::action_handler(ctx.clone(), trans_rx));
tokio::spawn(async move {
let mut interval = tokio::time::interval(tokio::time::Duration::from_millis(250));
loop {
let _ = tick_tx.send(Action::Tick);
interval.tick().await;
}
});
Ok(Self {
should_quit: false,
main_window: MainWindow::new(ctx.clone()),
Expand All @@ -113,16 +106,15 @@ impl App {
}

async fn main_loop(&mut self, tui: &mut Tui) -> Result<()> {
let mut interval = tokio::time::interval(tokio::time::Duration::from_millis(250));
loop {
let tui_event = tui.next();
let action = self.action_rx.recv();
let tick_action = self.tick_rx.recv();
let tick_action = interval.tick();

tokio::select! {
tick = tick_action => {
if let Some(_) = tick {
self.ctx.action_tx.send(Action::Tick).unwrap();
}
_ = tick_action => {
self.ctx.action_tx.send(Action::Tick).unwrap();
},

event = tui_event => {
Expand Down

0 comments on commit b8685ce

Please sign in to comment.