aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index 83adf9711..315f4a4d6 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -29,9 +29,6 @@ use crate::{
29 Result, ServerConfig, 29 Result, ServerConfig,
30}; 30};
31 31
32const THREADPOOL_SIZE: usize = 8;
33const MAX_IN_FLIGHT_LIBS: usize = THREADPOOL_SIZE - 3;
34
35#[derive(Debug)] 32#[derive(Debug)]
36pub struct LspError { 33pub struct LspError {
37 pub code: i32, 34 pub code: i32,
@@ -168,7 +165,7 @@ pub fn main_loop(
168 ) 165 )
169 }; 166 };
170 167
171 let pool = ThreadPool::new(THREADPOOL_SIZE); 168 let pool = ThreadPool::default();
172 let (task_sender, task_receiver) = unbounded::<Task>(); 169 let (task_sender, task_receiver) = unbounded::<Task>();
173 let (libdata_sender, libdata_receiver) = unbounded::<LibraryData>(); 170 let (libdata_sender, libdata_receiver) = unbounded::<LibraryData>();
174 171
@@ -371,7 +368,8 @@ fn loop_turn(
371 loop_state.pending_libraries.extend(changes); 368 loop_state.pending_libraries.extend(changes);
372 } 369 }
373 370
374 while loop_state.in_flight_libraries < MAX_IN_FLIGHT_LIBS 371 let max_in_flight_libs = pool.max_count().saturating_sub(2).max(1);
372 while loop_state.in_flight_libraries < max_in_flight_libs
375 && !loop_state.pending_libraries.is_empty() 373 && !loop_state.pending_libraries.is_empty()
376 { 374 {
377 let (root, files) = loop_state.pending_libraries.pop().unwrap(); 375 let (root, files) = loop_state.pending_libraries.pop().unwrap();