https://github.com/joway/hive
Hive is a high-efficiency goroutine pool based on pond.
https://github.com/joway/hive
Last synced: about 1 year ago
JSON representation
Hive is a high-efficiency goroutine pool based on pond.
- Host: GitHub
- URL: https://github.com/joway/hive
- Owner: joway
- Created: 2021-01-22T05:16:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-22T05:41:28.000Z (over 5 years ago)
- Last Synced: 2025-03-25T07:51:07.620Z (about 1 year ago)
- Language: Go
- Size: 6.84 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hive

[](https://goreportcard.com/report/github.com/joway/hive)
[](https://codecov.io/gh/joway/hive)
[](https://circleci.com/gh/joway/hive)
Hive is a high-efficiency **Goroutine Pool** based on [pond](https://github.com/joway/pond).
## Get Started
```go
h, err := hive.New(
hive.WithSize(10),
hive.WithNonblocking(false),
)
if err != nil {
log.Fatal(err)
}
err = h.Submit(context.Background(), func () {
//do something
time.Sleep(time.Millisecond * 100)
})
if err != nil {
log.Fatal(err)
}
```
## Configuration
| Option | Default | Description |
| ------------------|:--------------:| :------------|
| Size | 10 |Size of the goroutine pool.|
| MinIdle | 0 |The minimum size of the idle goroutines.|
| MaxIdle | 10 |The maximal size of the idle goroutines.|
| MinIdleTime | 5m |The minimum time that an idle goroutine should be reserved.|
| Nonblocking | false |If true, return ErrOverload when all workers is busy. Otherwise, block Submit method.|