Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oneofone/limiter
https://github.com/oneofone/limiter
Last synced: about 5 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/oneofone/limiter
- Owner: OneOfOne
- Created: 2019-12-12T19:03:41.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-12T20:07:17.000Z (almost 5 years ago)
- Last Synced: 2024-06-20T14:26:03.342Z (5 months ago)
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# limiter [![GoDoc](http://godoc.org/github.com/OneOfOne/limiter?status.svg)](http://godoc.org/github.com/OneOfOne/limiter) [![Build Status](https://travis-ci.org/OneOfOne/limiter.svg?branch=master)](https://travis-ci.org/OneOfOne/limiter)
limiter provides a simple limited job queue with context support
## ack Example
```go
package mainimport (
"context""github.com/OneOfOne/limiter"
)func main() {
l := limiter.NewWithContext(context.Background(), runtime.NumCPU())for i := range [1000]struct{}{} {
l.Do(func(ctx context.Context) error {
// do something
})
}
l.Wait()
}
```## License
This project is released under the [BSD 3-clause "New" or "Revised" License](https://github.com/golang/go/blob/master/LICENSE).