Skip to content

Fix secondary rate limits URL - #3001

Merged
gmlewis merged 2 commits into
google:masterfrom
Letiste:leo.sale/secondary-rate-limits
Nov 27, 2023
Merged

Fix secondary rate limits URL#3001
gmlewis merged 2 commits into
google:masterfrom
Letiste:leo.sale/secondary-rate-limits

Conversation

@Letiste

Copy link
Copy Markdown
Contributor

GitHub updated its documentation for rate limits and is now sending the following message when a secondary rate limit is triggered:

{
"message": "You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later. If you reach out to GitHub Support for help, please include the request ID XXXX.",
"documentation_url": "https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits"
}

This PR updates the check on the documentation_url to detect a secondary rate limit

Comment threadgithub/github.go
}
case r.StatusCode == http.StatusForbidden &&
(strings.HasSuffix(errorResponse.DocumentationURL, "#abuse-rate-limits") ||
strings.HasSuffix(errorResponse.DocumentationURL, "#secondary-rate-limits")):

@LetisteLetisteNov 23, 2023

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Would it be good to also check for secondary rate limit in the error message to be more resilient to future documentation updates?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IMO, either or should be fine.

@Letiste
Letiste marked this pull request as ready for review November 23, 2023 09:50
@codecov

codecovBot commented Nov 24, 2023

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (942692e) 97.93% compared to head (adf7891) 97.93%.

Additional details and impacted files
@@ Coverage Diff @@## master #3001 +/- ##
=======================================
Coverage 97.93% 97.93% =======================================
Files 150 150 Lines 12952 12952 =======================================
Hits 12685 12685 Misses 190 190 Partials 77 77 

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

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @Letiste !

Comment threadgithub/github.go Outdated
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@Letiste
Letiste requested a review from gmlewisNovember 24, 2023 14:17

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @Letiste !
LGTM.

Awaiting second LGTM+Approval from any other contributor to this repo before merging.

@gmlewisgmlewis added the NeedsReview PR is awaiting a review before merging. label Nov 24, 2023

@liaodanielliaodaniel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@gmlewisgmlewis removed the NeedsReview PR is awaiting a review before merging. label Nov 26, 2023
@gmlewis

Copy link
Copy Markdown
Collaborator

Thank you, @liaodaniel !
Merging.

@gmlewis
gmlewis merged commit 182859f into google:masterNov 27, 2023
gmlewis pushed a commit to o-sama/go-github that referenced this pull request Dec 19, 2023
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
Sign up for freeto 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.

3 participants

@Letiste@gmlewis@liaodaniel