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

Add fields to RateLimits struct #2340

Merged
merged 5 commits into from May 16, 2022
Merged

Add fields to RateLimits struct #2340

merged 5 commits into from May 16, 2022

Conversation

shokada
Copy link
Contributor

@shokada shokada commented Apr 24, 2022

Fixes: #2339

What this PR does / why we need it:

I added fields to RateLimits struct to get rate limits other than core and search

Special notes for your reviewer:

Since there is no documentation for source_import, code_scanning_upload, actions_runner_registration, and scim, I did not know which endpoints had the rate limit set, so I did not fix category function.

go-github/github/github.go

Lines 1126 to 1134 in 942d33d

// category returns the rate limit category of the endpoint, determined by Request.URL.Path.
func category(path string) rateLimitCategory {
switch {
default:
return coreCategory
case strings.HasPrefix(path, "/search/"):
return searchCategory
}
}

@google-cla
Copy link

google-cla bot commented Apr 24, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

github/github.go Outdated
SourceImport *Rate `json:"source_import"`
CodeScanningUpload *Rate `json:"code_scanning_upload"`
ActionsRunnerRegistration *Rate `json:"actions_runner_registration"`
Scim *Rate `json:"scim"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There seems to be no document for source_import, code_scanning_upload, actions_runner_registration, scim.

@shokada shokada marked this pull request as ready for review April 24, 2022 01:06
@gmlewis gmlewis changed the title Add fields to RateLimits struct. Add fields to RateLimits struct Apr 24, 2022
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @shokada!
Let's tweak some of the acronym names, please.
Then we should be ready for a second LGTM+Approval before merging.

github/github.go Outdated Show resolved Hide resolved
github/github.go Outdated Show resolved Hide resolved
@gmlewis
Copy link
Collaborator

gmlewis commented Apr 24, 2022

Also please remember to run gofmt on your edited files and go generate ./... , then push (not force-push) the changed files to the PR.

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Apr 24, 2022
@shokada
Copy link
Contributor Author

shokada commented Apr 24, 2022

Run go generate ./... 5887f39

@shokada shokada requested a review from gmlewis April 24, 2022 22:51
@codecov
Copy link

codecov bot commented Apr 24, 2022

Codecov Report

Merging #2340 (a6c7bcd) into master (00e4233) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2340   +/-   ##
=======================================
  Coverage   98.04%   98.05%           
=======================================
  Files         118      118           
  Lines       10458    10476   +18     
=======================================
+ Hits        10254    10272   +18     
  Misses        140      140           
  Partials       64       64           
Impacted Files Coverage Δ
github/github.go 97.80% <100.00%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00e4233...a6c7bcd. Read the comment docs.

github/github.go Outdated
sourceImportCategory //nolint:deadcode,varcheck
codeScanningUploadCategory //nolint:deadcode,varcheck
actionsRunnerRegistrationCategory //nolint:deadcode,varcheck
scimCategory //nolint:deadcode,varcheck
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since TestClient_rateLimits does not pass, I have defined unused constants.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of doing this, we actually need to use these values in the category function (lines 1127-1134 below) and in the RateLimits method (lines 1154-1163 below).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in the RateLimits method (lines 1154-1163 below).

fixed a6c7bcd

in the category function (lines 1127-1134 below)

I could not figure out how to fix the category function for the following reasons...

Since there is no documentation for source_import, code_scanning_upload, actions_runner_registration, and scim, I did not know which endpoints had the rate limit set, so I did not fix category function.
#2340 (comment)

github/github.go Outdated
sourceImportCategory //nolint:deadcode,varcheck
codeScanningUploadCategory //nolint:deadcode,varcheck
actionsRunnerRegistrationCategory //nolint:deadcode,varcheck
scimCategory //nolint:deadcode,varcheck
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of doing this, we actually need to use these values in the category function (lines 1127-1134 below) and in the RateLimits method (lines 1154-1163 below).

@shokada shokada requested a review from gmlewis April 25, 2022 12:18
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @shokada !
LGTM.

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

Copy link
Contributor

@raynigon raynigon left a comment

Choose a reason for hiding this comment

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

LGTM

@gmlewis
Copy link
Collaborator

gmlewis commented May 16, 2022

LGTM

Thank you, @raynigon !
Merging.

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label May 16, 2022
@gmlewis gmlewis merged commit a58d5f0 into google:master May 16, 2022
@patrickmarabeas
Copy link
Contributor

@gmlewis is it possible to get a fresh release pushed out? Thanks!

@gmlewis
Copy link
Collaborator

gmlewis commented May 25, 2022

Yes, I can work on one tomorrow.

@gmlewis
Copy link
Collaborator

gmlewis commented May 25, 2022

@gmlewis is it possible to get a fresh release pushed out? Thanks!

@patrickmarabeas - v45 has now been released: https://github.com/google/go-github/releases/tag/v45.0.0

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.

Add fields to RateLimits struct
4 participants