-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Milestone
Description
In this code, the AsParallel() is effectively a nop:
sdk/src/Cli/dotnet/commands/dotnet-tool/restore/ToolRestoreCommand.cs
Lines 100 to 103 in b122320
| ToolRestoreResult[] toolRestoreResults = | |
| packagesFromManifest | |
| .Select(package => InstallPackages(package, configFile)) | |
| .AsParallel().ToArray(); |
The AsParallel() here is only going to affect the ToArray call, which isn't parallelizable on its own. Presumably the intention was to parallelize the Select.ToArray, in which case the AsParallel needs to be moved to before the Select call:
ToolRestoreResult[] toolRestoreResults =
packagesFromManifest
.AsParallel()
.Select(package => InstallPackages(package, configFile))
.ToArray();If it's not desirable to parallelize the Select call (e.g. if InstallPackages isn't safe to be invoked in parallel or if InstallPackages won't benefit from being invoked in parallel), then the .AsParallel() should just be removed.
Reactions are currently unavailable