File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,6 @@ use crate::{
2929 Result , ServerConfig ,
3030} ;
3131
32- const THREADPOOL_SIZE : usize = 8 ;
33- const MAX_IN_FLIGHT_LIBS : usize = THREADPOOL_SIZE - 3 ;
34-
3532#[ derive( Debug ) ]
3633pub struct LspError {
3734 pub code : i32 ,
@@ -168,7 +165,7 @@ pub fn main_loop(
168165 )
169166 } ;
170167
171- let pool = ThreadPool :: new ( THREADPOOL_SIZE ) ;
168+ let pool = ThreadPool :: default ( ) ;
172169 let ( task_sender, task_receiver) = unbounded :: < Task > ( ) ;
173170 let ( libdata_sender, libdata_receiver) = unbounded :: < LibraryData > ( ) ;
174171
@@ -371,7 +368,8 @@ fn loop_turn(
371368 loop_state. pending_libraries . extend ( changes) ;
372369 }
373370
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
375373 && !loop_state. pending_libraries . is_empty ( )
376374 {
377375 let ( root, files) = loop_state. pending_libraries . pop ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments