5301: Don't spawn notify unnecessary r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-07-10 21:46:02 +00:00 committed by GitHub
commit 6c920d9ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -182,6 +182,7 @@ impl GlobalState {
}
},
};
let watch = match self.config.files.watcher {
FilesWatcher::Client => vec![],
FilesWatcher::Notify => project_folders.watch,

View File

@ -1,5 +1,4 @@
//! See `Include`.
use std::convert::TryFrom;
use globset::{Glob, GlobSet, GlobSetBuilder};

View File

@ -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 });