diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs index 9293cb8..646e4b7 100644 --- a/src/frontend/mod.rs +++ b/src/frontend/mod.rs @@ -2,6 +2,7 @@ use std::{ collections::{BTreeMap, VecDeque}, io, net::SocketAddr, + time::Duration, }; use crossterm::event::{Event, EventStream, KeyCode, KeyEvent, KeyEventKind}; @@ -73,6 +74,7 @@ impl App { } async fn handle_events(&mut self) -> io::Result<()> { + let mut tick = tokio::time::interval(Duration::from_millis(100)); tokio::select! { event = self.events.next().fuse() => { if let Some(Ok(evt)) = event { @@ -86,7 +88,7 @@ impl App { } } } - _ = tokio::time::sleep(tokio::time::Duration::from_millis(100)) => {} + _ = tick.tick() => {} } Ok(())