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

Predict *RateLimitError, return immediately without network call (9700x speedup when rate limit exceeded). #347

Merged
merged 3 commits into from
May 4, 2016
Merged

Commits on May 3, 2016

  1. Keep track of all rate limits in client.

    In GitHub API, there are currently two categories of rate limits: core
    and search. Previously, the client only tracked the rate limit from the
    most recent API call. This change makes it track both rate limit
    categories.
    
    This will be useful in the following commit.
    dmitshur committed May 3, 2016
    Configuration menu
    Copy the full SHA
    bbe5f62 View commit details
    Browse the repository at this point in the history
  2. Predict *RateLimitError, return immediately without network call.

    When possible to do so reliably, i.e., the client knows that the rate
    limit is exceeded and reset time is in the future, immediately return
    *RateLimitError without making network calls to GitHub API.
    
    Add a unit test covering RateLimits method populating client.rateLimits.
    
    Remove commented out code.
    
    Helps #152 and #153.
    dmitshur committed May 3, 2016
    Configuration menu
    Copy the full SHA
    b07f95e View commit details
    Browse the repository at this point in the history
  3. Deprecate Client.Rate() method in favor of Response.Rate.

    Client.Rate() method is unreliable in situations when API calls are made
    by others that may hit different rate limit categories (core and search).
    Each API call already returns a Response struct that contains an accurate
    Rate, so that's a better mechanism to access this information.
    
    See relevant discussion at #347 (comment).
    dmitshur committed May 3, 2016
    Configuration menu
    Copy the full SHA
    13c2701 View commit details
    Browse the repository at this point in the history