Class GitHubAbuseLimitHandler

java.lang.Object
org.kohsuke.github.GitHubAbuseLimitHandler
Direct Known Subclasses:
AbuseLimitHandler

public abstract class GitHubAbuseLimitHandler extends Object
Pluggable strategy to determine what to do when the API rate limit is reached.
Author:
Kohsuke Kawaguchi, Liam Newman
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The HTTP 429 Too Many Requests response status code indicates the user has sent too many requests in a given amount of time ("rate limiting").
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create default GitHubAbuseLimitHandler instance
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    onError(GitHubConnectorResponse connectorResponse)
    Called when the library encounters HTTP error indicating that the API abuse limit is reached.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TOO_MANY_REQUESTS

      public static final int TOO_MANY_REQUESTS
      The HTTP 429 Too Many Requests response status code indicates the user has sent too many requests in a given amount of time ("rate limiting"). A Retry-After header might be included to this response indicating how long to wait before making a new request. Why is this hardcoded here? The HttpURLConnection class is missing the status codes above 415, so the constant needs to be sourced from elsewhere.
      See Also:
  • Constructor Details

    • GitHubAbuseLimitHandler

      public GitHubAbuseLimitHandler()
      Create default GitHubAbuseLimitHandler instance
  • Method Details

    • onError

      public abstract void onError(@Nonnull GitHubConnectorResponse connectorResponse) throws IOException
      Called when the library encounters HTTP error indicating that the API abuse limit is reached.

      Any exception thrown from this method will cause the request to fail, and the caller of github-api will receive an exception. If this method returns normally, another request will be attempted. For that to make sense, the implementation needs to wait for some time.

      Parameters:
      connectorResponse - Response information for this request.
      Throws:
      IOException - on failure
      See Also: