I recently found that we had a lot of places where bucket_span did not span the whole interval we checked when using count or exceeded?, like when checking a rate limit for the last 24 hours without modifying bucket_span in the initualizer.
The failure is silent and I could imagine that a lot of tests would not catch this, if the adds are not wrapped in timecop etc.
I'd suggest that when the count method receives a options[:interval] larger than options[:bucket_span] an error is raised, so the problem is uncovered.
I recently found that we had a lot of places where
bucket_span
did not span the whole interval we checked when usingcount
orexceeded?
, like when checking a rate limit for the last 24 hours without modifyingbucket_span
in the initualizer.The failure is silent and I could imagine that a lot of tests would not catch this, if the
add
s are not wrapped in timecop etc.I'd suggest that when the
count
method receives aoptions[:interval]
larger thanoptions[:bucket_span]
an error is raised, so the problem is uncovered.Does that make any sense?