Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
pacer/ | H | 06-Apr-2019 | - | |||
.gitignore | H A D | 06-Apr-2019 | 270 | |||
.travis.yml | H A D | 06-Apr-2019 | 189 | |||
LICENSE | H A D | 06-Apr-2019 | 1.1 KiB | |||
README.md | H A D | 06-Apr-2019 | 1.5 KiB | |||
doc.go | H A D | 06-Apr-2019 | 3 KiB | |||
go.test.sh | H A D | 06-Apr-2019 | 271 | |||
workerpool.go | H A D | 06-Apr-2019 | 8 KiB | |||
workerpool_test.go | H A D | 06-Apr-2019 | 9.9 KiB |
README.md
1# workerpool 2[![Build Status](https://travis-ci.org/gammazero/workerpool.svg)](https://travis-ci.org/gammazero/workerpool) 3[![Go Report Card](https://goreportcard.com/badge/github.com/gammazero/workerpool)](https://goreportcard.com/report/github.com/gammazero/workerpool) 4[![codecov](https://codecov.io/gh/gammazero/workerpool/branch/master/graph/badge.svg)](https://codecov.io/gh/gammazero/workerpool) 5[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/gammazero/workerpool/blob/master/LICENSE) 6 7Concurrency limiting goroutine pool. Limits the concurrency of task execution, not the number of tasks queued. Never blocks submitting tasks, no matter how many tasks are queued. 8 9[![GoDoc](https://godoc.org/github.com/gammazero/workerpool?status.svg)](https://godoc.org/github.com/gammazero/workerpool) 10 11This implementation builds on ideas from the following: 12 13- http://marcio.io/2015/07/handling-1-million-requests-per-minute-with-golang 14- http://nesv.github.io/golang/2014/02/25/worker-queues-in-go.html 15 16## Installation 17To install this package, you need to setup your Go workspace. The simplest way to install the library is to run: 18``` 19$ go get github.com/gammazero/workerpool 20``` 21 22## Example 23```go 24package main 25 26import ( 27 "fmt" 28 "github.com/gammazero/workerpool" 29) 30 31func main() { 32 wp := workerpool.New(2) 33 requests := []string{"alpha", "beta", "gamma", "delta", "epsilon"} 34 35 for _, r := range requests { 36 r := r 37 wp.Submit(func() { 38 fmt.Println("Handling request:", r) 39 }) 40 } 41 42 wp.StopWait() 43} 44``` 45