Conversation
…erformance bump for large orgs)
…r unhandled exception classes
There was a problem hiding this comment.
Pull Request Overview
This PR improves the GitHub service integration by refactoring organization member retrieval for clarity and performance, adding retry logic to network calls, and enhancing test coverage.
- Refactors organization member fetching to use retryable wrappers
- Increases Octokit per_page setting for better performance on large orgs
- Adds additional unit tests for various edge cases
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| spec/unit/spec_helper.rb | Adds stubs for sleep to bypass delays in tests |
| spec/unit/entitlements/service/github_spec.rb | Adds new contexts for admin/member edge cases |
| spec/unit/entitlements/backend/github_team/service_spec.rb | Adjusts test expectations for retry behavior |
| lib/entitlements/service/github.rb | Refactors methods to use Retryable, increases per_page |
| lib/entitlements/config/retry.rb | Adds custom Retryable configuration |
| lib/entitlements/backend/github_team/service.rb | Wraps GitHub team API calls in retryable blocks |
| lib/entitlements/backend/github_team.rb | Adds Retry setup call |
| lib/entitlements/backend/github_org/service.rb | Wraps organization membership updates in retryable |
| lib/entitlements/backend/github_org.rb | Adds Retry setup call |
| entitlements-github-plugin.gemspec | Adds dependency on retryable gem |
Comments suppressed due to low confidence (1)
spec/unit/entitlements/backend/github_team/service_spec.rb:848
- [nitpick] Hardcoding the retry count as exactly 3 times may lead to brittle tests if the retry configuration is updated in the future. Consider using the configured retry value or a more flexible expectation to ensure the test remains robust.
expect(octokit).to receive(:team).with(1234).and_raise(exc).exactly(3).times
northrup
approved these changes
Apr 16, 2025
northrup
approved these changes
Apr 16, 2025
northrup
approved these changes
Apr 16, 2025
northrup
approved these changes
Apr 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Service Improvements
This pull request does the following:
organization_members()to make it bit easier to read.retryablegem to the project as a runtime dep and assigns it a standard configuration.octokitwith a retryable block for unhandled exception classes.per_pagesetting of Octokit from 30 -> 100. This changes it from the default to the max.A pretty significant bonus of setting the
per_pagedefault from 30 -> 100 is an increase in performance for large organizations. Specifically orgs with a few thousand members (or more), will see a performance bump here.