Files
server/scripts/retry_giftfetch.ps1
2026-07-31 17:53:48 +03:00

19 lines
553 B
PowerShell

# Retry giftfetch up to N times with exponential backoff.
$outDir = '.\\data\\official-gifts'
$maxAttempts = 20
for ($i = 1; $i -le $maxAttempts; $i++) {
Write-Output "giftfetch loop attempt $i"
& .\\giftfetch.exe -out $outDir
$code = $LASTEXITCODE
Write-Output "giftfetch exitcode=$code"
if ($code -eq 0) {
Write-Output "giftfetch finished successfully"
break
}
$sleep = [int](30 * $i)
Write-Output "sleeping ${sleep}s before retry"
Start-Sleep -Seconds $sleep
}
Write-Output "retry loop completed"