Fixed cpu usage being pinned at 100% when watching.

This was due to the default timeout being 0ms.
This commit is contained in:
Filipe Rodrigues 2023-12-16 04:18:51 +00:00
parent f7f867ff91
commit 8ca24b6ba6

View File

@ -145,7 +145,7 @@ async fn main() -> ExitResult {
.watch
.then(|| {
// TODO: Better default?
let debouncer_timeout_ms = args.watcher_debouncer_timeout_ms.unwrap_or(0.0_f64);
let debouncer_timeout_ms = args.watcher_debouncer_timeout_ms.unwrap_or(10.0_f64);
let debouncer_timeout = { Duration::from_secs_f64(debouncer_timeout_ms / 1000.0) };
Watcher::new(builder.subscribe_events(), debouncer_timeout)