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.
Does that make any sense?
I recently found that we had a lot of places where
bucket_spandid not span the whole interval we checked when usingcountorexceeded?, like when checking a rate limit for the last 24 hours without modifyingbucket_spanin 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
countmethod receives aoptions[:interval]larger thanoptions[:bucket_span]an error is raised, so the problem is uncovered.Does that make any sense?