summaryrefslogtreecommitdiff
path: root/src/watch.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-09-26 12:26:24 +0200
committermo8it <mo8it@proton.me>2024-09-26 12:26:24 +0200
commitd4fa61e4358bdc83173c346121c992836f1b7152 (patch)
tree91b831e2e960a261ffb1b0f8017448b78a2cc450 /src/watch.rs
parent554301b8e9a1c3f8eda05d616fbdb909e2ebf640 (diff)
Debounce file change events
Diffstat (limited to 'src/watch.rs')
-rw-r--r--src/watch.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/watch.rs b/src/watch.rs
index fd89b29..11450b4 100644
--- a/src/watch.rs
+++ b/src/watch.rs
@@ -69,11 +69,11 @@ fn run_watch(
// Prevent dropping the guard until the end of the function.
// Otherwise, the file watcher exits.
let _watcher_guard = if let Some(exercise_names) = notify_exercise_names {
+ let notify_event_handler =
+ NotifyEventHandler::build(watch_event_sender.clone(), exercise_names)?;
+
let mut watcher = RecommendedWatcher::new(
- NotifyEventHandler {
- sender: watch_event_sender.clone(),
- exercise_names,
- },
+ notify_event_handler,
Config::default().with_poll_interval(Duration::from_secs(1)),
)
.inspect_err(|_| eprintln!("{NOTIFY_ERR}"))?;