[release/v7.5] Retry ClearlyDefined operations (#25387)

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This commit is contained in:
PowerShell Team Bot
2025-04-17 17:01:59 -05:00
committed by GitHub
co-authored by Travis Plunk
parent a873b33b65
commit 16f5b45526
@@ -27,7 +27,7 @@ function Start-ClearlyDefinedHarvest {
$coordinates = Get-ClearlyDefinedCoordinates @PSBoundParameters
$body = @{tool='package';coordinates=$coordinates} | convertto-json
Write-Verbose $body -Verbose
(Invoke-WebRequest -Method Post -Uri 'https://api.clearlydefined.io/harvest' -Body $body -ContentType 'application/json').Content
(Invoke-WebRequest -Method Post -Uri 'https://api.clearlydefined.io/harvest' -Body $body -ContentType 'application/json' -MaximumRetryCount 5 -RetryIntervalSec 60 -Verbose).Content
}
}
@@ -117,7 +117,7 @@ Function Get-ClearlyDefinedData {
continue
}
Invoke-RestMethod -Uri "https://api.clearlydefined.io/definitions/$coordinates" | ForEach-Object {
Invoke-RestMethod -Uri "https://api.clearlydefined.io/definitions/$coordinates" -MaximumRetryCount 5 -RetryIntervalSec 60 | ForEach-Object {
[bool] $harvested = if ($_.licensed.declared) { $true } else { $false }
Add-Member -NotePropertyName cachedTime -NotePropertyValue (get-date) -InputObject $_ -PassThru | Add-Member -NotePropertyName harvested -NotePropertyValue $harvested -PassThru
if ($_.harvested) {