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

Fix API calls failing because of secondary api limits #1853

Merged
merged 3 commits into from
Jun 19, 2024

Conversation

jeetchoudhary
Copy link
Contributor

@jeetchoudhary jeetchoudhary commented Jun 14, 2024

Issue: After upgrading GitHub Enterprise Server (GHES) from version 3.9 to 3.11 and 3.12, we encountered issues with failing API calls during Git search (and other)operations. Further investigation revealed that the newer GHES versions consume more CPU resources, leading to secondary rate limits being reached more frequently. Below is a quote from GitHub Enterprise Support:
"Customers planning to upgrade to GitHub Enterprise Server (GHES) version 3.11 or higher should be aware of the potential for increased CPU utilization. If a system's peak CPU usage is already high, typically above 65-70%, it is strongly advisable to scale up the server resources before upgrading. This is to accommodate the additional load from new features and improvements that are part of the latest releases."

Moreover, we realized that GitHub does not guarantee the presence of the Retry-After header. However, the gh-limited-by header is included in the response when the error is due to rate-limiting

We got ourselves unblocked after making this change. I see the issue is reported by another user here as well
#1805

Fix: The intention is not to change any existing functionality. So ended up adding an additional optional check, so that the API client can wait for another minute before retrying the API call if either of the headers are present. With the new change the client will execute this block https://github.com/hub4j/github-api/blob/main/src/main/java/org/kohsuke/github/AbuseLimitHandler.java#L82-L93 which is not happening right now

Copy link

codecov bot commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.04%. Comparing base (92112af) to head (8d6964d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1853   +/-   ##
=========================================
  Coverage     81.03%   81.04%           
- Complexity     2411     2418    +7     
=========================================
  Files           233      233           
  Lines          7347     7349    +2     
  Branches        399      398    -1     
=========================================
+ Hits           5954     5956    +2     
  Misses         1148     1148           
  Partials        245      245           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bitwiseman bitwiseman self-requested a review June 15, 2024 22:52
Copy link
Member

@bitwiseman bitwiseman left a comment

Choose a reason for hiding this comment

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

Needs test to cover the new functionality. Otherwise looks good.

@jeetchoudhary
Copy link
Contributor Author

image

@bitwiseman bitwiseman self-requested a review June 19, 2024 07:51
@bitwiseman bitwiseman merged commit d0a1071 into hub4j:main Jun 19, 2024
11 checks passed
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