github.com/alexrios/lbucket (go): Package lbucket provides support for using leaky buckets on your app.  Creating a new Leaky bucket informing 3 as the bucket capacity and the frequency how the bucket leaks.  Calling Refill() you're add more volume in the bucket.  Note: When the bucket capacity is reached a ErrBucketReachedCap will be returned until the bucket leaks once again. A simple errors.Is could be used in this scenario:  To stop the bucket leaking you can call the Fix() method.  Use Size() to get to current volume in the bucket.
Keywords: golang|idiomatic|leaky-bucket