-
-
Save calmh/335e3ecab6786b806a813a5e6ebb382c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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