diff options
Diffstat (limited to 'src/app/data_harvester.rs')
-rw-r--r-- | src/app/data_harvester.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/app/data_harvester.rs b/src/app/data_harvester.rs index 67ff1e5b..362b7251 100644 --- a/src/app/data_harvester.rs +++ b/src/app/data_harvester.rs @@ -194,7 +194,20 @@ impl DataCollector { self.update_data(); - std::thread::sleep(std::time::Duration::from_millis(250)); + // Sleep a few seconds to avoid potentially weird data... + let sleep_duration = { + cfg_if::cfg_if! { + if #[cfg(target_os = "freebsd")] { + // FreeBSD's min duration value is 1s, which is a bit too long for me so I'll accept the one-time + // inaccuracy. + std::time::Duration::from_millis(250) + } else { + sysinfo::System::MINIMUM_CPU_UPDATE_INTERVAL + Duration::from_millis(1) + } + } + }; + + std::thread::sleep(sleep_duration); self.data.cleanup(); } |