Skip to content

Instantly share code, notes, and snippets.

@calmh
Created January 23, 2017 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calmh/335e3ecab6786b806a813a5e6ebb382c to your computer and use it in GitHub Desktop.
Save calmh/335e3ecab6786b806a813a5e6ebb382c to your computer and use it in GitHub Desktop.
jb@unu:~/s/g/c/j/timetest $ go run main.go
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
jb@unu:~/s/g/c/j/timetest $ cat main.go
package main
import (
"fmt"
"time"
"golang.org/x/time/rate"
)
func main() {
r := rate.NewLimiter(0, 1000)
for i := 0; i < 15; i++ {
fmt.Println(r.AllowN(time.Now(), 100))
}
}
jb@unu:~/s/g/c/j/timetest $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment