File tree Expand file tree Collapse file tree
Actions/DownloadProjectDependencies Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,27 +47,10 @@ function Get-AppFileFromUrl {
4747 OutputDebug - message " Overwriting existing file '$sanitizedFileName '. Multiple dependencies may resolve to the same filename."
4848 }
4949
50- # Download with retry logic (compatible with PS5 and PS7)
51- $maxRetries = 3
52- $retryIntervalSec = 5
53- $retryCount = 0
54- $success = $false
55- while (-not $success -and $retryCount -lt $maxRetries ) {
56- try {
57- Invoke-WebRequest - Method GET - UseBasicParsing - Uri $Url - OutFile $appFile | Out-Null
58- $success = $true
59- }
60- catch {
61- $retryCount ++
62- if ($retryCount -lt $maxRetries ) {
63- Write-Host " Download failed, retrying in $retryIntervalSec seconds... (Attempt $retryCount of $maxRetries )"
64- Start-Sleep - Seconds $retryIntervalSec
65- }
66- else {
67- throw $_
68- }
69- }
70- }
50+ # Download with retry logic
51+ Invoke-CommandWithRetry - ScriptBlock {
52+ Invoke-WebRequest - Method GET - UseBasicParsing - Uri $Url - OutFile $appFile | Out-Null
53+ } - RetryCount 3 - FirstDelay 5 - MaxWaitBetweenRetries 10
7154
7255 return $appFile
7356}
You can’t perform that action at this time.
0 commit comments