Skip to content

Commit

Permalink
define TICK_RATE const
Browse files Browse the repository at this point in the history
  • Loading branch information
pythops committed Sep 15, 2024
1 parent efcdb1a commit bc88935
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion oryx-tui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ use crate::stats::Stats;

pub type AppResult<T> = std::result::Result<T, Box<dyn error::Error>>;

pub const TICK_RATE: u64 = 30;

#[derive(Debug, Copy, Clone, PartialEq)]
pub enum FocusedBlock {
Interface,
Expand Down Expand Up @@ -143,7 +145,7 @@ impl App {
let mut last_index = 0;
let mut pattern = String::new();
loop {
thread::sleep(Duration::from_millis(30));
thread::sleep(Duration::from_millis(TICK_RATE));
let packets = packets.lock().unwrap();
let mut fuzzy = fuzzy.lock().unwrap();

Expand Down
4 changes: 2 additions & 2 deletions oryx-tui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
use std::io;

use clap::{crate_description, crate_version, Command};
use oryx_tui::app::{App, AppResult};
use oryx_tui::app::{App, AppResult, TICK_RATE};
use oryx_tui::event::{Event, EventHandler};
use oryx_tui::handler::handle_key_events;
use oryx_tui::tui::Tui;
Expand All @@ -26,7 +26,7 @@ fn main() -> AppResult<()> {

let backend = CrosstermBackend::new(io::stdout());
let terminal = Terminal::new(backend)?;
let events = EventHandler::new(50);
let events = EventHandler::new(TICK_RATE);
let mut tui = Tui::new(terminal, events);
tui.init()?;

Expand Down

0 comments on commit bc88935

Please sign in to comment.