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

Add 1 second buffer to expiry to correct throttles #85

Merged
merged 1 commit into from
Sep 9, 2014

Commits on Sep 2, 2014

  1. Add 1 second buffer to expiry to correct throttles

    Fixes #69.
    
    There was a race condition when `Time.now.to_i` changes between when
    `epoch_time` is computed in line 18, and the cache request is made (and
    the `key` is expired).
    
    I.e., a throttle check starts at t0, but doesn’t reach the cache until
    t1, the cache will have expired the throttle count. The request will
    likely be allowed, even if the request exceeded the limit.
    
    This has the effect of keeping keys in cache about 1 second longer than
    strictly necessary. But the extra cache space seems like a good
    trade-off for correct throttling.
    ktheory committed Sep 2, 2014
    Configuration menu
    Copy the full SHA
    074e8e5 View commit details
    Browse the repository at this point in the history