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

HTTP rate limit errors are not propagated. #72

Open
smettu1 opened this issue Jan 14, 2022 · 0 comments
Open

HTTP rate limit errors are not propagated. #72

smettu1 opened this issue Jan 14, 2022 · 0 comments

Comments

@smettu1
Copy link

smettu1 commented Jan 14, 2022

Github graphql errors.

We were running a lot of graphql queries using multiple coroutines, we were running into issues where data returned is null.
In this case, we assume there is no more data from Github and stop the iteration. Eventually, we realized that data that we have doesn't match up with that of Github. Further debugging we found that we were getting secondary rate limit errors which were not sent back to the client.

Function:
c.runWithJSON(ctx, req, resp)

	res, err := c.httpClient.Do(r)
	if err != nil {
		return err
	}
	defer res.Body.Close()

Does not propagate 403 rate limit errors , in which case if there is 403 library will try to read the data and pass it upstream.
Example error message:

"documentation_url": "https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#secondary-rate-limits",
  "message": "You have exceeded a secondary rate limit. Please wait a few minutes before you try again."

Sample fix:

if res.StatusCode != 200 {
return errors.Wrap(err, "status code error ")
}
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

No branches or pull requests

1 participant