upsidr / merge-gatekeeper

Get better merge control
MIT License
85 stars 14 forks source link

How do you handle GitHub rate limit #37

Closed antoinelyset closed 1 year ago

antoinelyset commented 1 year ago

As said in the GitHub doc:

When using GITHUB_TOKEN, the rate limit is 1,000 requests per hour per repository.

src

This isn't a lot, if you check every 30 secs and have 9 PRs continuously checking you will cross the limit (and the GITHUB_TOKEN can be used for other queries).

Do you know a workaround or this is just the way it is?

rytswd commented 1 year ago

Hi @antoinelyset - thanks for raising the issue! ☺️

We have seen the rate limit time to time internally, but in most cases we simply just waited for it to be lifted. This isn't ideal, and especially troublesome when there are so many commits / PRs taking place at the same time.

The fundamental problem is that we have no other choice but to run some polling to get the latest job states. We haven't found any other way to achieve the logic we are after. Looking at the GitHub API doc, I can see there is a way to get the rate limit status. We may be able to incorporate the rate limit status and back off our check intervals based on that. https://docs.github.com/en/rest/rate-limit#about-the-rate-limit-api

We will look into possibilities of at least reducing the chance of getting rate limit blockage. If you have any suggestions, we would love to hear your thoughts! 👍

antoinelyset commented 1 year ago

Hy @rytswd! Thanks for the quick answer. Indeed it doesn't seem easy to have a quick fix. I was thinking of maybe building an Application which will listen to Webhooks (so more of a push model than a pull) but that's a completely different project.

I think we can close this for now.

Thanks for this great work in any cases.

antoinelyset commented 1 year ago

I'm closing this for now ;)