From 4df965a002b5296fc728f1bc2fb9312fe421ea5d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 4 Sep 2018 04:13:22 +0300 Subject: work --- crates/server/src/main_loop/mod.rs | 9 ++++++--- crates/server/src/vfs.rs | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'crates/server/src') diff --git a/crates/server/src/main_loop/mod.rs b/crates/server/src/main_loop/mod.rs index 58f6f88a7..52e3b661d 100644 --- a/crates/server/src/main_loop/mod.rs +++ b/crates/server/src/main_loop/mod.rs @@ -8,7 +8,7 @@ use std::{ use threadpool::ThreadPool; use serde::{Serialize, de::DeserializeOwned}; -use crossbeam_channel::{bounded, Sender, Receiver}; +use crossbeam_channel::{unbounded, Sender, Receiver}; use languageserver_types::{NumberOrString}; use libanalysis::{FileId, JobHandle, JobToken, LibraryData}; use gen_lsp_server::{ @@ -38,7 +38,7 @@ pub fn main_loop( msg_sender: &mut Sender, ) -> Result<()> { let pool = ThreadPool::new(4); - let (task_sender, task_receiver) = bounded::(16); + let (task_sender, task_receiver) = unbounded::(); let (fs_sender, fs_receiver, fs_watcher) = vfs::roots_loader(); let (ws_sender, ws_receiver, ws_watcher) = workspace_loader(); @@ -97,7 +97,7 @@ fn main_loop_inner( pending_requests: &mut HashMap, subs: &mut Subscriptions, ) -> Result<()> { - let (libdata_sender, libdata_receiver) = bounded(1024); + let (libdata_sender, libdata_receiver) = unbounded(); ws_sender.send(ws_root.clone()); fs_sender.send(ws_root.clone()); loop { @@ -137,7 +137,10 @@ fn main_loop_inner( let files = state.events_to_files(events); let sender = libdata_sender.clone(); pool.execute(move || { + let start = ::std::time::Instant::now(); + info!("indexing {} ... ", root.display()); let data = LibraryData::prepare(files); + info!("indexed {:?} {}", start.elapsed(), root.display()); sender.send(data); }); } diff --git a/crates/server/src/vfs.rs b/crates/server/src/vfs.rs index 69a7654af..2699fc21e 100644 --- a/crates/server/src/vfs.rs +++ b/crates/server/src/vfs.rs @@ -3,7 +3,7 @@ use std::{ fs, }; -use crossbeam_channel::{Sender, Receiver, bounded}; +use crossbeam_channel::{Sender, Receiver, unbounded}; use walkdir::WalkDir; use { @@ -23,8 +23,8 @@ pub enum FileEventKind { } pub fn roots_loader() -> (Sender, Receiver<(PathBuf, Vec)>, ThreadWatcher) { - let (path_sender, path_receiver) = bounded::(2048); - let (event_sender, event_receiver) = bounded::<(PathBuf, Vec)>(1); + let (path_sender, path_receiver) = unbounded::(); + let (event_sender, event_receiver) = unbounded::<(PathBuf, Vec)>(); let thread = ThreadWatcher::spawn("roots loader", move || { path_receiver .into_iter() -- cgit v1.2.3