gofri / go-github-ratelimit

A GoLang HTTP RoundTripper that handles GitHub API secondary rate limits
MIT License
41 stars 13 forks source link

Secondary rate limits are missed because documentation URL is changed #19

Closed jlevesy closed 11 months ago

jlevesy commented 11 months ago

Hey 👋

Thanks for this library! I just started to work with it!

Sadly I'm currently facing a case where it is actually missing a secondary rate limit, similar to #14 but this time it's because the DocumentationURL has changed 😭

Here's some output from my debugger:

(dlv) p body
github.com/gofri/go-github-ratelimit/github_ratelimit.SecondaryRateLimitBody {
        Message: "You have exceeded a secondary rate limit. Please wait a few minutes before you try again. If you reach out to GitHub Support for help, please include the request ID 7ACA:D38B:2658D6B:26C1625:65737E71.",
        DocumentURL: "https://docs.github.com/en/free-pro-team@latest/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits",}

Which doesn't match the expected /rest/overview/resources-in-the-rest-api#secondary-rate-limits

I'm opening a fix :)

jlevesy commented 11 months ago

Actually fixed by #18

gofri commented 11 months ago

Hey @jlevesy, Thank you for reporting this issue!

I think that the recent fix to look only for the suffix should do, except that we need to replace the logical-and with logical-or, as in the PR you referenced. I'm still on low availability so I hope that I'll get to it soon.

Edit: I just went over the code of #18, and it does exactly that. Unfortunately it kinda breaks backwards compatibility (e.g. for GHES), so we can just make it more flexible and use that.

gofri commented 11 months ago

@jlevesy The fix is merged. I'll create a new tag soon. Thanks again!

jlevesy commented 11 months ago

Thanks to @zendesk-piotrpawluk who did the heavylifting!