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

feat(errors): handle secondary rate limit error from GitHub #110

Merged

Conversation

arkus7
Copy link
Contributor

@arkus7 arkus7 commented Dec 16, 2023

First of all, thanks for this tool!

We have a lot of repositories in our organization and fetching stats with org-stats resulted in GitHub's secondary rate limit1 error being returned from their API. org-stats didn't handle this so I've put some functions to do so.

The go-github doesn't seem to have a struct like SecondaryRateLimitError so I've created a custom one.

The issue happened when fetching the review stats, but I've applied the same action to the rest of the places where the "normal" rate limit is being handled.

This is my first contribution with Go (I'm fairly new to the language) so I would appreciate any feedback you might have.

The code is heavily inspired by go-github-ratelimit2 package.

Footnotes

  1. https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits

  2. https://github.com/gofri/go-github-ratelimit

@caarlos0 caarlos0 merged commit 367f4e1 into caarlos0:master Dec 18, 2023
1 of 3 checks passed
@caarlos0
Copy link
Owner

looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants