-
Notifications
You must be signed in to change notification settings - Fork 769
Accept 429 response codes as an indication of the secondary rate limit being exceeded #1895
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e6fe5c9
Accept 429 as an indication of the rate limit
holly-cummins f17f206
Remove assertion which is mostly asserting about the configuration of…
holly-cummins 34c4a8e
Add extra test to bring coverage above threshold, also handle case wh…
holly-cummins ee276ad
Reformat header to resolve warning
holly-cummins 8d57cd4
Update src/main/java/org/kohsuke/github/AbuseLimitHandler.java
bitwiseman c6075e6
Update src/main/java/org/kohsuke/github/AbuseLimitHandler.java
bitwiseman 098fc48
Apply suggestions from code review
bitwiseman caa5167
Merge branch 'main' into accept-429
bitwiseman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
45 changes: 45 additions & 0 deletions
45
...dlerTest/wiremock/testHandler_Wait_Secondary_Limits_Too_Many_Requests/__files/1-user.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "login": "bitwiseman", | ||
| "id": 1958953, | ||
| "node_id": "MDQ6VXNlcjE5NTg5NTM=", | ||
| "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", | ||
| "gravatar_id": "", | ||
| "url": "https://api.github.com/users/bitwiseman", | ||
| "html_url": "https://github.com/bitwiseman", | ||
| "followers_url": "https://api.github.com/users/bitwiseman/followers", | ||
| "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", | ||
| "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", | ||
| "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", | ||
| "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", | ||
| "organizations_url": "https://api.github.com/users/bitwiseman/orgs", | ||
| "repos_url": "https://api.github.com/users/bitwiseman/repos", | ||
| "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", | ||
| "received_events_url": "https://api.github.com/users/bitwiseman/received_events", | ||
| "type": "User", | ||
| "site_admin": false, | ||
| "name": "Liam Newman", | ||
| "company": "Cloudbees, Inc.", | ||
| "blog": "", | ||
| "location": "Seattle, WA, USA", | ||
| "email": "bitwiseman@gmail.com", | ||
| "hireable": null, | ||
| "bio": "https://twitter.com/bitwiseman", | ||
| "public_repos": 181, | ||
| "public_gists": 7, | ||
| "followers": 146, | ||
| "following": 9, | ||
| "created_at": "2012-07-11T20:38:33Z", | ||
| "updated_at": "2020-02-06T17:29:39Z", | ||
| "private_gists": 8, | ||
| "total_private_repos": 10, | ||
| "owned_private_repos": 0, | ||
| "disk_usage": 33697, | ||
| "collaborators": 0, | ||
| "two_factor_authentication": true, | ||
| "plan": { | ||
| "name": "free", | ||
| "space": 976562499, | ||
| "collaborators": 0, | ||
| "private_repos": 10000 | ||
| } | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHubClient has a method to get Date (or Instant).
https://github.com/hub4j/github-api/blob/main/src/main/java/org/kohsuke/github/GitHubClient.java#L916
Unfortunately, diff from local machine time is not reliable. The local machine may not be synchronized with the server time. We have to use the diff from the response time.
https://github.com/hub4j/github-api/blob/main/src/main/java/org/kohsuke/github/GHRateLimit.java#L543-L571
However, this PR is a huge step forward and I'd rather have this less than perfect code added than wait for the next release.
I'll approve and file an issue to fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! (And thanks for explaining about the diff to the response time, that makes a lot of sense.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. If you have time to circle back and address #1909 , that would be awesome. Thanks for the great contribution!