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

Handle GitHub Rate Limiting and Abuse Rate Limiting #9

Open
adamzolyak opened this issue Dec 11, 2018 · 2 comments
Open

Handle GitHub Rate Limiting and Abuse Rate Limiting #9

adamzolyak opened this issue Dec 11, 2018 · 2 comments

Comments

@adamzolyak
Copy link
Contributor

Proposed implementation:

  • Send requests in batches (ex. 20) with a 1 second pause between batches.
  • Check for HTTP 4xx.
  • If HTTP 4xx, check X-RateLimit-Remaining and Retry-After headers.
  • If X-RateLimit-Remaining < number of HTTP calls required, stop and output console message.
  • If Retry-After wait number of seconds specified before sending additional requests.

I also feel like I've seen HTTP 401 during normal (non-abuse) rate limiting. Investigate more and handle if needed.

@adamzolyak
Copy link
Contributor Author

suggestion to resolve #4

@iandouglas
Copy link
Contributor

const response = await context.github.issues.create({})
console.log(response.meta)

// output:
{
  "x-ratelimit-limit": 5000,
  "x-ratelimit-remaining": 4999,
  "x-ratelimit-reset": 1544635447,
}

there may be additional headers like x-retry-after in there as well.

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

2 participants