Skip to content

Implement rate limiting in NuGet package push script to manage push f…#25388

Merged
voloagent merged 1 commit into
rel-10.4from
skoc/nuget-push
May 7, 2026
Merged

Implement rate limiting in NuGet package push script to manage push f…#25388
voloagent merged 1 commit into
rel-10.4from
skoc/nuget-push

Conversation

@skoc10

@skoc10 skoc10 commented May 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

…requency and enhance error handling for 4xx responses by parsing retry-after values.
@skoc10 skoc10 added this to the 10.4-final milestone May 7, 2026
@skoc10 skoc10 requested review from Copilot and voloagent May 7, 2026 12:11
@skoc10 skoc10 added the devops label May 7, 2026
@skoc10 skoc10 changed the base branch from dev to rel-10.4 May 7, 2026 12:11
@voloagent voloagent merged commit 5ec877d into rel-10.4 May 7, 2026
4 checks passed
@voloagent voloagent deleted the skoc/nuget-push branch May 7, 2026 12:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the NuGet package push automation script to better handle NuGet.org throttling by adding a per-hour push rate limiter and honoring server-provided retry after guidance during 4xx retries.

Changes:

  • Added a sliding-window rate limiter to cap pushes per hour.
  • Enhanced 4xx retry handling to parse and use NuGet’s retry after: <seconds>s value when present.
  • Renamed the static retry delay array to $defaultQuotaRetryDelaysInSeconds.

Comment thread nupkg/push_packages.ps1
Comment on lines +39 to +43
$pushTimestamps = [System.Collections.Generic.List[datetime]]$recentPushes

if ($pushTimestamps.Count -ge $maxPushesPerHour)
{
$waitUntil = $pushTimestamps[0].AddHours(1)
Comment thread nupkg/push_packages.ps1
Comment on lines +76 to +80
$retryAfterMatch = ($pushOutput | Out-String) | Select-String -Pattern 'retry after:\s*(\d+)s' -AllMatches
if ($retryAfterMatch -and $retryAfterMatch.Matches.Count -gt 0)
{
$retryDelay = [int]$retryAfterMatch.Matches[0].Groups[1].Value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants