Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(vcs): refactor getCommits to use errgroup #3533

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

marcsanmi
Copy link
Contributor

@marcsanmi marcsanmi commented Aug 30, 2024

Follow-up PR for #3529 (comment).

Refactor the getCommits function in the VCS service to use errgroup instead of sync.WaitGroup.

Changes

  • Implement errgroup for better concurrency management
  • Set a limit (10) on concurrent requests to GitHub API

Note on error handling

I kept the existing error handling approach, collecting errors explicitly through the channel rather than relying on errgroup's built-in error handling, since it will only return the first encountered error.

@marcsanmi marcsanmi requested a review from a team as a code owner August 30, 2024 14:05
Copy link
Contributor

@bryanhuhta bryanhuhta left a comment

Choose a reason for hiding this comment

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

This looks good, I forgot that errgroup only returns the first error. That's pretty lame. Anyway, at least we have some concurrency limits here so we don't gobble up our entire ratelimit budget in one RPC 😁

@marcsanmi marcsanmi merged commit 102e6b4 into main Aug 30, 2024
18 checks passed
@marcsanmi marcsanmi deleted the add-errgroup-vcs-get-commits branch August 30, 2024 14:50
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.

2 participants