Respect Limits
Github has limits for number of request per hour. It sets following headers describing current state of rate limit in each response: X-RateLimit-Limit
, X-RateLimit-Remaining
, and X-RateLimit-Reset
. For further information see API Documentation.
If you want to control limits, you can use CarefulWire
class for it. If X-RateLimit-Remaining
of received response is less than a given threshold, CarefulWire
will sleep until a time specified in the X-RateLimit-Reset
header.
You can use CarefulWire
with Github
:
Github github = new RtGithub( new RtGithub().entry().through(CarefulWire.class, 50) );