Skip to content

Don't mark the first V2 feed request as a retry - #7841

Merged
Nigusu-Allehu merged 1 commit into
NuGet:devfrom
AsadIqbal-Dev:dev-asadiqbal-v2-search-delay
Nov 4, 2026
Merged

Nigusu-Allehu merged 1 commit into
NuGet:devfrom
AsadIqbal-Dev:dev-asadiqbal-v2-search-delay

Conversation

@AsadIqbal-Dev

Copy link
Copy Markdown
Contributor

Bug

Fixes: NuGet/Home#12195

Description

SearchAsync against a V2 feed waits about a second before it sends its first request. As @jeffkl traced in the issue, V2FeedParser.Search passes a null SourceCacheContext, so QueryV2FeedAsync takes its uncached branch, and that branch sets IsRetry = true on the request. HttpRetryHandler treats tries > 0 || request.IsRetry as a retry, so it waits RetryDelay plus up to 200 ms before the first send.

I removed the IsRetry = true. The request still gets its normal retries when it fails, because those are counted by tries. The flag is also passed to the HTTP diagnostic events, so a first request no longer reports itself as a retry there. I couldn't find a reason for it in the code, and the other callers only set IsRetry from their retry counter (retry > 1).

The issue triage mentions NuGet/Home#12215 as a likely shared cause. This only changes the V2 search path.

Test: new V2FeedParser_Search_FirstRequestIsNotMarkedAsRetry captures the request sent to the retry handler. It fails on dev.

NuGet.Protocol.Tests on net10.0, filtered to V2FeedParser, HttpSource, HttpRetryHandler and PackageSearchResourceV2: 104 passed, 2 skipped.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

The uncached branch of V2FeedParser.QueryV2FeedAsync set IsRetry = true, so HttpRetryHandler waited out the retry delay before sending the first request.
@AsadIqbal-Dev
AsadIqbal-Dev requested a review from a team as a code owner November 2, 2026 17:06
@dotnet-policy-service dotnet-policy-service Bot added the Community PRs created by someone not in the NuGet team label Nov 2, 2026
@Nigusu-Allehu
Nigusu-Allehu merged commit 54377e1 into NuGet:dev Nov 4, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PRs created by someone not in the NuGet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SearchAsync against v2 endpoints has artificial internal delay

4 participants