Skip to content

getCachedOrFetchPRs has no singleflight guard causing redundant concurrent paginated GitHub PR fetches #7057

@aashu2006

Description

@aashu2006

User Request

Type: bug
Target: Console Application
Submitted by: @aashu2006
Console Request ID: 033d714f-4442-4d49-82bc-f6eb2db3c6d1

Description

What happened:
In pkg/api/handlers/feedback.go:734-760, between RUnlock() and Lock(), N concurrent callers all miss the cache and each independently execute two full paginated GitHub PR fetches (open + closed). The re-check under the write lock prevents duplicate writes but does not prevent the redundant concurrent fetches. The code even acknowledges this race in a comment at line 750.

What I expected:
singleflight should coalesce concurrent cold-cache fetches into a single set of paginated GitHub API calls.

Steps to reproduce:

  1. Let the PR cache expire
  2. Send 10 concurrent ListAllFeatureRequests requests
  3. Observe 10 × 2 redundant paginated GitHub PR fetch operations

This issue was automatically created from the KubeStellar Console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-fix-requestedai-processingAI is currently processing this issuekind/bugCategorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.triage/neededNeeds triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions