16 lines
310 B
Go
16 lines
310 B
Go
package main
|
|
|
|
import "time"
|
|
import "fmt"
|
|
|
|
func main() {
|
|
throttle := time.Tick(time.Millisecond * 200)
|
|
for {
|
|
<-throttle
|
|
go fmt.Println("rate-limited action")
|
|
}
|
|
}
|
|
|
|
// todo: credit code.google.com/p/go-wiki/wiki/RateLimiting
|
|
// review gentry's example: https://gist.github.com/3876453
|