Conversation
Refactor GitHub client to improve concurrency and rate limiting - Replaced `conc.WaitGroup` with `sync.WaitGroup` for better compatibility. - Added rate-limiting logic to handle GitHub API rate limits. - Introduced a channel to limit concurrent requests to 50. - Updated `go-github` library to v71 and adjusted imports. - Updated dependencies in `go.mod` and `go.sum` to latest versions. ```
Refactor GitHub API calls to use a goroutine pool Replaced custom concurrency management with a pool from the sourcegraph/conc library to limit concurrent requests to 90. Improved rate limit handling by logging and sleeping when limits are exceeded. Updated dependencies in go.mod and go.sum. ```
There was a problem hiding this comment.
Pull Request Overview
This PR updates the GitHub API integration to use a newer version of go-github while adding rate-limit handling and concurrency control improvements.
- Upgraded the GitHub API client from v58 to v71.
- Replaced the custom concurrency management using a channel and WaitGroup with a pool-based approach.
- Added a helper method to handle rate-limit pauses during API requests.
Files not reviewed (1)
- go.mod: Language not supported
There was a problem hiding this comment.
Pull Request Overview
This PR updates the GitHub API client and refactors the concurrency handling for retrieving starred repositories by introducing a goroutine pool with a limit, while adding support for rate limit handling.
- Upgraded the GitHub client library from v58 to v71.
- Replaced channel-based concurrency with a pool limiting concurrency to 90 goroutines.
- Added a helper function (getStarredRepositories) to manage rate limits and retries.
Files not reviewed (1)
- go.mod: Language not supported
- Added error handling to GetRepositories and its helper functions. - Improved concurrency management with context and error propagation. - Adjusted rate limit handling to avoid exceeding API limits.
There was a problem hiding this comment.
Pull Request Overview
This PR enhances GitHub API processing by introducing error handling for repository retrieval and incorporating rate limit management with concurrent requests. Key changes include:
- Modifying GetRepositories to return an error and handling it in main.go
- Upgrading the go-github library to v71 and refactoring repository fetching to use a goroutine pool
- Introducing a sleep-and-retry mechanism for rate limit handling in getStarredRepositories
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| main.go | Added error handling for GetRepositories and adjusted temp execution |
| github.go | Upgraded go-github version, refactored GetRepositories, and improved rate limit handling via a pool and sleep logic |
Files not reviewed (1)
- go.mod: Language not supported
Comments suppressed due to low confidence (1)
github.go:76
- [nitpick] The variable 'p' for the pool is very terse. Consider renaming it to a more descriptive name such as 'repoPool' to enhance code readability.
p := pool.NewWithResults[[]*github.StarredRepository]().
related: #46