bvaisvil / zenith

Zenith - sort of like top or htop but with zoom-able charts, CPU, GPU, network, and disk usage
MIT License
2.63k stars 67 forks source link

Display database path with ticks error. #127

Open noyez opened 1 year ago

noyez commented 1 year ago

I ran across issue #126 and became puzzled as to where the database existed. I added a line of code which displays the location of the database when this error occurs. There might be a better way to display this value, however i thought it might be useful to signal to the user where the database lived.

diff --git a/src/main.rs b/src/main.rs
index fd3770c..c8c526e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -82,7 +82,8 @@ fn use_db_history(db_path: &Path, tick_rate: u64) -> Option<bool> {
         let tick = Duration::from_millis(tick_rate);
         if map.tick != tick {
             println!(
-                "Database tick: {} does not match supplied tick: {}.",
+                "Using Database:{:?}\nDatabase tick: {} does not match supplied tick: {}.",
+                db_path,
                 map.tick.as_millis(),
                 tick.as_millis()
             );

example output:

Using Database:"/home/b/.cache/zenith/store"
Database tick: 0 does not match supplied tick: 2000.
Proceed with (D)atabase tick: 0, (S)upplied tick with history disabled: 2000, (E)xit?:
bvaisvil commented 1 year ago

That would be helpful. Happy to accept a PR.