Skip to content

Commit 33f5737

Browse files
committed
reintroduce dynamic throttle
1 parent 91765e9 commit 33f5737

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/GenerateModules.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ $AutoRestTempFolder | ForEach-Object {
9292
}
9393

9494
$Stopwatch = [system.diagnostics.stopwatch]::StartNew()
95-
$Throttle = 2 # Reduced from 4 to prevent file locking issues in parallel module generation
95+
$CpuCount = (Get-CimInstance Win32_Processor | Measure-Object -Property NumberOfLogicalProcessors -Sum).Sum
96+
$Throttle = [int][math]::Max(1, [math]::Min(4, $CpuCount / 2)) # Use half the CPU count but max 4, min 1
9697
$Results = $ModuleToGenerate | ForEach-Object -Parallel {
9798
$Module = $_
9899
Write-Host -ForegroundColor Green "-------------'Generating $Module'-------------"

0 commit comments

Comments
 (0)