@@ -40,6 +40,7 @@ public sealed partial class DependencyManager : IDisposable
40
40
41
41
private readonly Lazy < Runtime > runtimeLazy ;
42
42
private Runtime Runtime => runtimeLazy . Value ;
43
+ private readonly int threads = EnvironmentVariables . GetDefaultNumberOfThreads ( ) ;
43
44
44
45
/// <summary>
45
46
/// Performs C# dependency fetching.
@@ -752,7 +753,7 @@ private void ResolveConflicts(IEnumerable<string> frameworkPaths)
752
753
753
754
private void AnalyseSolutions ( IEnumerable < string > solutions )
754
755
{
755
- Parallel . ForEach ( solutions , new ParallelOptions { MaxDegreeOfParallelism = EnvironmentVariables . GetDefaultNumberOfThreads ( ) } , solutionFile =>
756
+ Parallel . ForEach ( solutions , new ParallelOptions { MaxDegreeOfParallelism = threads } , solutionFile =>
756
757
{
757
758
try
758
759
{
@@ -842,7 +843,7 @@ private void RestoreProjects(IEnumerable<string> projects, out IEnumerable<strin
842
843
var successCount = 0 ;
843
844
var assetFiles = new List < string > ( ) ;
844
845
var sync = new object ( ) ;
845
- Parallel . ForEach ( projects , new ParallelOptions { MaxDegreeOfParallelism = EnvironmentVariables . GetDefaultNumberOfThreads ( ) } , project =>
846
+ Parallel . ForEach ( projects , new ParallelOptions { MaxDegreeOfParallelism = threads } , project =>
846
847
{
847
848
logger . LogInfo ( $ "Restoring project { project } ...") ;
848
849
var res = dotnet . Restore ( new ( project , packageDirectory . DirInfo . FullName , ForceDotnetRefAssemblyFetching : true ) ) ;
@@ -942,7 +943,7 @@ private void DownloadMissingPackages(List<FileInfo> allFiles, ISet<string> dllPa
942
943
var successCount = 0 ;
943
944
var sync = new object ( ) ;
944
945
945
- Parallel . ForEach ( notYetDownloadedPackages , new ParallelOptions { MaxDegreeOfParallelism = EnvironmentVariables . GetDefaultNumberOfThreads ( ) } , package =>
946
+ Parallel . ForEach ( notYetDownloadedPackages , new ParallelOptions { MaxDegreeOfParallelism = threads } , package =>
946
947
{
947
948
var success = TryRestorePackageManually ( package . Name , nugetConfig , package . PackageReferenceSource ) ;
948
949
if ( ! success )
0 commit comments