Implement Leaky Bucket Algorithm
shalarewicz opened this issue · comments
Implement LeakyBucket
class per the spec in #50. The implementation should pass the tests written in #52
The LeakyBucket algorithm works similarly to TokenBucket except that requests are processed at a fixed rate. The algorithm is usually implemented with a FIFO queue and works as follow:
- When a request arrives, the limiter checks if the queue is full. If it is not full, the request is added to the queue.
- Otherwise, the request is dropped (a 429 status is sent)
- Requests are pulled from the queue and processed at regular intervals
Add retryAfter
to rate limiter response per #89
Include testing and spec.