| To limit the rate of operations per unit time, use a [time.Ticker](http://golang.org/pkg/time/#NewTicker). |
| This works well for rates up to tens of operations per second. |
| For higher rates, prefer a token bucket rate limiter such as [golang.org/x/time/rate.Limiter](https://godoc.org/golang.org/x/time/rate) (also search godoc.org for |
| [rate limit](http://godoc.org/?q=rate+limit)). |
| throttle := time.Tick(rate) |
| for req := range requests { |
| <-throttle // rate limit our Service.Method RPCs |
| go client.Call("Service.Method", req, ...) |
| To allow some bursts, add a buffer to the throttle: |
| tick := time.NewTicker(rate) |
| throttle := make(chan time.Time, burstLimit) |
| } // exits after tick.Stop() |
| for req := range requests { |
| <-throttle // rate limit our Service.Method RPCs |
| go client.Call("Service.Method", req, ...) |