From dac9a4cebd39e7865235530fa69e5ae4ab42962b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 10 Jul 2020 23:39:25 +0200 Subject: Don't spawn notify unnecessary --- crates/vfs-notify/src/include.rs | 1 - crates/vfs-notify/src/lib.rs | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'crates/vfs-notify/src') diff --git a/crates/vfs-notify/src/include.rs b/crates/vfs-notify/src/include.rs index 72f928536..59da3d77a 100644 --- a/crates/vfs-notify/src/include.rs +++ b/crates/vfs-notify/src/include.rs @@ -1,5 +1,4 @@ //! See `Include`. - use std::convert::TryFrom; use globset::{Glob, GlobSet, GlobSetBuilder}; diff --git a/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs index ee5035554..6aaa53f63 100644 --- a/crates/vfs-notify/src/lib.rs +++ b/crates/vfs-notify/src/lib.rs @@ -82,11 +82,13 @@ impl NotifyActor { Event::Message(msg) => match msg { Message::Config(config) => { self.watcher = None; - let (watcher_sender, watcher_receiver) = unbounded(); - let watcher = log_notify_error(Watcher::new_immediate(move |event| { - watcher_sender.send(event).unwrap() - })); - self.watcher = watcher.map(|it| (it, watcher_receiver)); + if !config.watch.is_empty() { + let (watcher_sender, watcher_receiver) = unbounded(); + let watcher = log_notify_error(Watcher::new_immediate(move |event| { + watcher_sender.send(event).unwrap() + })); + self.watcher = watcher.map(|it| (it, watcher_receiver)); + } let n_total = config.load.len(); self.send(loader::Message::Progress { n_total, n_done: 0 }); -- cgit v1.2.3