Skip to content

Commit

Permalink
Move away from the debounced watcher: we have our own debouncing via …
Browse files Browse the repository at this point in the history
…the Graph, and we want to avoid things like notify-rs/notify#205.

# Delete this line to force CI to run the JVM tests.
[ci skip-jvm-tests]
  • Loading branch information
Stu Hood committed May 13, 2020
1 parent 9506fbf commit 8bb78d8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
31 changes: 15 additions & 16 deletions src/rust/engine/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/rust/engine/watch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ graph = { path = "../graph" }
hashing = { path = "../hashing" }
log = "0.4"
logging = { path = "../logging" }
# notify is currently an experimental API, we are pinning to https://docs.rs/notify/5.0.0-pre.1/notify/
# because the latest prerelease at time of writing has removed the debounced watcher which we would like to use.
# The author suggests they will add the debounced watcher back into the stable 5.0.0 release. When that happens
# we can move to it.
notify = { git = "https://github.com/notify-rs/notify", rev = "fba00891d9105e2f581c69fbe415a58cb7966fdd" }
notify = "5.0.0-pre.2"
parking_lot = "0.6"
task_executor = { path = "../task_executor" }

Expand Down
10 changes: 8 additions & 2 deletions src/rust/engine/watch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,14 @@ impl InvalidationWatcher {
let canonical_build_root =
std::fs::canonicalize(build_root.as_path()).map_err(|e| format!("{:?}", e))?;
let (watch_sender, watch_receiver) = crossbeam_channel::unbounded();
let mut watcher: RecommendedWatcher = Watcher::new(watch_sender, Duration::from_millis(50))
.map_err(|e| format!("Failed to begin watching the filesystem: {}", e))?;
let mut watcher: RecommendedWatcher = Watcher::new_immediate(move |ev| {
if watch_sender.send(ev).is_err() {
// The watch thread shutting down first is ok, because it can exit when the Invalidatable
// is dropped.
debug!("Watch thread has shutdown, but Watcher is still running.");
}
})
.map_err(|e| format!("Failed to begin watching the filesystem: {}", e))?;

let (liveness_sender, liveness_receiver) = crossbeam_channel::unbounded();

Expand Down

0 comments on commit 8bb78d8

Please sign in to comment.