Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 862 Bytes

README.md

File metadata and controls

18 lines (13 loc) · 862 Bytes

stoplight Build Status

This package provides a simple in-memory rate limiter based on the leaking bucket model. It currently has a single module Stoplight.Bucket with the intention of adding more rate-limiting models over time within the same Stoplight namespace.

Stoplight.Bucket

A simple in-memory rate limiter based on the leaking-bucket model. You can spend any capacity already available in the bucket. When it's full, you can burst it down. When it's empty, you need to wait for it to sufficiently fill up before you can continue.

Internally, it uses semaphores and a forkIO'ed background thread to achieve its effect. This means each has a small overhead and you have to be careful when using a large number of limiters concurrently.