Skip to content

Fetch contributions concurrently for faster all and graph commands#16

Merged
maxbeizer merged 1 commit intomainfrom
concurrent-fetching
Feb 26, 2026
Merged

Fetch contributions concurrently for faster all and graph commands#16
maxbeizer merged 1 commit intomainfrom
concurrent-fetching

Conversation

@maxbeizer
Copy link
Copy Markdown
Owner

Summary

Fetches PRs, reviews, issues, and discussions in parallel using goroutines, making all and graph commands ~4x faster.

Changes

  • fetchAllContributions() — shared helper that spawns 4 goroutines to fetch all contribution types concurrently, with mutex-protected result aggregation
  • handleAllCommand and handleGraphCommand — refactored to use the shared concurrent helper, removing ~90 lines of duplicate sequential fetch code
  • Thread-safe mocksMockGitHubClient and MockGraphQLClient now use sync.Mutex for race-free concurrent testing

Performance

Before: 4 sequential API calls (each with potential pagination)
After: 4 concurrent API calls — total wall time ≈ slowest single call

All 30 tests pass with -race.

- Add fetchAllContributions() that fetches PRs, reviews, issues, and
  discussions in parallel using goroutines
- Refactor handleAllCommand and handleGraphCommand to use shared helper
- Make mock clients thread-safe with sync.Mutex for race-free tests
- ~4x faster for commands that fetch multiple contribution types

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@maxbeizer maxbeizer merged commit df61a3a into main Feb 26, 2026
@maxbeizer maxbeizer deleted the concurrent-fetching branch February 26, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant