diff options
Diffstat (limited to 'crates/server/src/vfs.rs')
-rw-r--r-- | crates/server/src/vfs.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/server/src/vfs.rs b/crates/server/src/vfs.rs index 2699fc21e..c228f0b0a 100644 --- a/crates/server/src/vfs.rs +++ b/crates/server/src/vfs.rs | |||
@@ -3,11 +3,11 @@ use std::{ | |||
3 | fs, | 3 | fs, |
4 | }; | 4 | }; |
5 | 5 | ||
6 | use crossbeam_channel::{Sender, Receiver, unbounded}; | 6 | use crossbeam_channel::{Sender, Receiver}; |
7 | use walkdir::WalkDir; | 7 | use walkdir::WalkDir; |
8 | 8 | ||
9 | use { | 9 | use { |
10 | thread_watcher::ThreadWatcher, | 10 | thread_watcher::{ThreadWatcher, worker_chan}, |
11 | }; | 11 | }; |
12 | 12 | ||
13 | 13 | ||
@@ -22,11 +22,11 @@ pub enum FileEventKind { | |||
22 | Add(String), | 22 | Add(String), |
23 | } | 23 | } |
24 | 24 | ||
25 | pub fn roots_loader() -> (Sender<PathBuf>, Receiver<(PathBuf, Vec<FileEvent>)>, ThreadWatcher) { | 25 | pub fn roots_loader() -> ((Sender<PathBuf>, Receiver<(PathBuf, Vec<FileEvent>)>), ThreadWatcher) { |
26 | let (path_sender, path_receiver) = unbounded::<PathBuf>(); | 26 | let (interface, input_receiver, output_sender) = |
27 | let (event_sender, event_receiver) = unbounded::<(PathBuf, Vec<FileEvent>)>(); | 27 | worker_chan::<PathBuf, (PathBuf, Vec<FileEvent>)>(128); |
28 | let thread = ThreadWatcher::spawn("roots loader", move || { | 28 | let thread = ThreadWatcher::spawn("roots loader", move || { |
29 | path_receiver | 29 | input_receiver |
30 | .into_iter() | 30 | .into_iter() |
31 | .map(|path| { | 31 | .map(|path| { |
32 | debug!("loading {} ...", path.as_path().display()); | 32 | debug!("loading {} ...", path.as_path().display()); |
@@ -34,10 +34,10 @@ pub fn roots_loader() -> (Sender<PathBuf>, Receiver<(PathBuf, Vec<FileEvent>)>, | |||
34 | debug!("... loaded {}", path.as_path().display()); | 34 | debug!("... loaded {}", path.as_path().display()); |
35 | (path, events) | 35 | (path, events) |
36 | }) | 36 | }) |
37 | .for_each(|it| event_sender.send(it)) | 37 | .for_each(|it| output_sender.send(it)) |
38 | }); | 38 | }); |
39 | 39 | ||
40 | (path_sender, event_receiver, thread) | 40 | (interface, thread) |
41 | } | 41 | } |
42 | 42 | ||
43 | fn load_root(path: &Path) -> Vec<FileEvent> { | 43 | fn load_root(path: &Path) -> Vec<FileEvent> { |