tb
tb copied to clipboard
A generic lock-free implementation of the "Token-Bucket" algorithm
https://github.com/tsenart/tb/blob/master/bucket.go#L77 Why don't you put busy loop here just like the one in line #73?
// Bucket returns a Bucket with rate capacity, keyed by key. // // If a Bucket (key, rate) doesn't exist yet, it is created. // // You must call Close...
Given that: > If a Bucket (key, rate) doesn't exist yet, it is created. and > You must call Close when you're done with the Throttler in order to not...
We need an easy way to wait for tokens but with a timeout. Currently I have implemented this by calling Halt over and over and sleeping a bit between each,...