func main() {
limiter := rate.NewLimiter(3, time.Second)
for {
limiter.SleepIfRateExceeded(func() {
fmt.Println("only printed 3 times per second")
})
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
rate limit the execution of a function in Go
License
117/rate
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
rate limit the execution of a function in Go
Topics
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published