Added const to make rate switching in the future easier.

This commit is contained in:
ClementTsang 2019-09-25 12:42:39 -04:00
parent b5cacb3e2e
commit 674de1a2d4
3 changed files with 11 additions and 16 deletions

16
TODO.md
View File

@ -22,9 +22,7 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p
## After making public
- Consider bumping up the refresh rate to 3000?
- Arrow keys for lists. This is a priority!
- Scrolling support for temp/disk
- Travis
@ -46,18 +44,8 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p
- Remove any `unwrap()`, ensure no crashing! Might have to use this: <https://doc.rust-lang.org/std/panic/fn.catch_unwind.html>
- Scrolling event in lists
- Switching between panels
- Truncate columns if needed for tables
- Test for Windows support, mac support, other. May be doable, depends on sysinfo and how much I know about other OSes probably.
- Seems like the braille symbols are borked on windows.
- Issue with typing after windows version runs!
- Efficiency!!!
- Filtering in processes (that is, allow searching)
@ -66,6 +54,4 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p
- Modularity
- ~~Potentially process managing? Depends on the libraries...~~ Done on Linux!
- Probably good to add a "are you sure" to dd-ing...

View File

@ -1,3 +1,4 @@
// TODO: Store like three minutes of data, then change how much is shown based on scaling!
pub const STALE_MAX_MILLISECONDS : u64 = 60 * 1000; // We wish to store at most 60 seconds worth of data. This may change in the future, or be configurable.
pub const TICK_RATE_IN_MILLISECONDS : u64 = 200; // We use this as it's a good value to work with.
pub const DEFAULT_REFRESH_RATE_IN_MILLISECONDS : u128 = 1000;

View File

@ -56,7 +56,15 @@ fn main() -> error::Result<()> {
//.after_help("Themes:") // TODO: This and others disabled for now
.get_matches();
let update_rate_in_milliseconds : u128 = matches.value_of("RATE_MILLIS").unwrap_or("1000").parse::<u128>()?;
let update_rate_in_milliseconds : u128 = if matches.is_present("RATE_MILLIS") {
matches
.value_of("RATE_MILLIS")
.unwrap_or(&constants::DEFAULT_REFRESH_RATE_IN_MILLISECONDS.to_string())
.parse::<u128>()?
}
else {
constants::DEFAULT_REFRESH_RATE_IN_MILLISECONDS
};
if update_rate_in_milliseconds < 250 {
return Err(RustopError::InvalidArg {