Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/117/rate
rate limit the execution of a function in Go
https://github.com/117/rate
go golang rate-limit rate-limiter rate-limiting
Last synced: 21 days ago
JSON representation
rate limit the execution of a function in Go
- Host: GitHub
- URL: https://github.com/117/rate
- Owner: 117
- License: mpl-2.0
- Created: 2020-04-04T21:11:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-04-05T01:58:09.000Z (over 4 years ago)
- Last Synced: 2024-06-20T14:27:51.960Z (6 months ago)
- Topics: go, golang, rate-limit, rate-limiter, rate-limiting
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rate
```go
func main() {
limiter := rate.NewLimiter(3, time.Second)for {
limiter.SleepIfRateExceeded(func() {
fmt.Println("only printed 3 times per second")
})
}
}
```