File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -448,9 +448,15 @@ pub(crate) fn get_executor<'a>(
448
448
ram_budget : usize ,
449
449
process : & Process ,
450
450
) -> Result < Box < dyn Executor + ' a > > {
451
+ // Don't spawn more than this many I/O threads unless the user tells us to.
452
+ const DEFAULT_THREAD_LIMIT : usize = 8 ;
453
+
451
454
// If this gets lots of use, consider exposing via the config file.
452
455
let thread_count = match process. var ( "RUSTUP_IO_THREADS" ) {
453
- Err ( _) => available_parallelism ( ) . map ( |p| p. get ( ) ) . unwrap_or ( 1 ) ,
456
+ Err ( _) => available_parallelism ( )
457
+ . map ( |p| p. get ( ) )
458
+ . unwrap_or ( 1 )
459
+ . min ( DEFAULT_THREAD_LIMIT ) ,
454
460
Ok ( n) => n
455
461
. parse :: < usize > ( )
456
462
. context ( "invalid value in RUSTUP_IO_THREADS. Must be a natural number" ) ?,
You can’t perform that action at this time.
0 commit comments