GraphQL-Gate icon indicating copy to clipboard operation
GraphQL-Gate copied to clipboard

Implement Leaky Bucket Algorithm

Open shalarewicz opened this issue 3 years ago • 2 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

shalarewicz avatar Jun 23 '22 01:06 shalarewicz

Add retryAfter to rate limiter response per #89

shalarewicz avatar Jul 27 '22 14:07 shalarewicz

Include testing and spec.

evanmcneely avatar Aug 06 '22 21:08 evanmcneely