From 14f0c6d01a44a5bbe40479a173c5fe666fb73526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halvor=20Fladsrud=20B=C3=B8?= Date: Tue, 4 Feb 2020 17:06:29 +0100 Subject: [PATCH 1/2] Changed watcher to use polling --- src/directory/managed_directory.rs | 1 + src/directory/mmap_directory.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/directory/managed_directory.rs b/src/directory/managed_directory.rs index 5b1698d2c4..969027e8cf 100644 --- a/src/directory/managed_directory.rs +++ b/src/directory/managed_directory.rs @@ -306,6 +306,7 @@ impl Directory for ManagedDirectory { } fn watch(&self, watch_callback: WatchCallback) -> crate::Result { + // `WatchCallback` is only a function. self.directory.watch(watch_callback) } } diff --git a/src/directory/mmap_directory.rs b/src/directory/mmap_directory.rs index 0c48a07754..cab637917a 100644 --- a/src/directory/mmap_directory.rs +++ b/src/directory/mmap_directory.rs @@ -142,7 +142,7 @@ impl MmapCache { } struct WatcherWrapper { - _watcher: Mutex, + _watcher: Mutex, watcher_router: Arc, } @@ -150,7 +150,7 @@ impl WatcherWrapper { pub fn new(path: &Path) -> Result { let (tx, watcher_recv): (Sender, Receiver) = channel(); // We need to initialize the - let watcher = notify::raw_watcher(tx) + let watcher = notify::poll::PollWatcher::with_delay_ms(tx, 1) .and_then(|mut watcher| { watcher.watch(path, RecursiveMode::Recursive)?; Ok(watcher) From 22a702c17f9d59b8f55f732e0df9f93a65ea08ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halvor=20Fladsrud=20B=C3=B8?= Date: Tue, 4 Feb 2020 17:07:06 +0100 Subject: [PATCH 2/2] Removed temporary comment --- src/directory/managed_directory.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/directory/managed_directory.rs b/src/directory/managed_directory.rs index 969027e8cf..5b1698d2c4 100644 --- a/src/directory/managed_directory.rs +++ b/src/directory/managed_directory.rs @@ -306,7 +306,6 @@ impl Directory for ManagedDirectory { } fn watch(&self, watch_callback: WatchCallback) -> crate::Result { - // `WatchCallback` is only a function. self.directory.watch(watch_callback) } }