3 ms·
This isn’t using the same rate limiting approach as OP which follows the CloudFlare suggestion of a simplified sliding window which counts lastInterval/thisInte
by zaroth 8y ago
This isn’t using the same rate limiting approach as OP which follows the CloudFlare suggestion of a simplified sliding window which counts lastInterval/thisInterval instead of just a current interval counter that will reset in a single instant.
For daylong limits the single interval count may be less than ideal if a burst of activity happens to cross the reset threshold, the allowed rate will be double the expected limit.
Also, I think a trivial optimization would be to remove the GET call and just call INCR.