terraform-provider-google/vendor/github.com/gammazero/workerpool
The Magician 6b0fceb3c9 Delete GCS objects in parallel (#2944)
<!-- This change is generated by MagicModules. -->
/cc @sethvargo
2019-01-28 11:26:13 -08:00
..
.gitignore Delete GCS objects in parallel (#2944) 2019-01-28 11:26:13 -08:00
.travis.yml Delete GCS objects in parallel (#2944) 2019-01-28 11:26:13 -08:00
doc.go Delete GCS objects in parallel (#2944) 2019-01-28 11:26:13 -08:00
go.test.sh Delete GCS objects in parallel (#2944) 2019-01-28 11:26:13 -08:00
LICENSE Delete GCS objects in parallel (#2944) 2019-01-28 11:26:13 -08:00
README.md Delete GCS objects in parallel (#2944) 2019-01-28 11:26:13 -08:00
workerpool.go Delete GCS objects in parallel (#2944) 2019-01-28 11:26:13 -08:00

workerpool

Build Status Go Report Card codecov License

Concurrency 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.

GoDoc

This implementation builds on ideas from the following:

Installation

To install this package, you need to setup your Go workspace. The simplest way to install the library is to run:

$ go get github.com/gammazero/workerpool

Example

package main

import (
	"fmt"
	"github.com/gammazero/workerpool"
)

func main() {
	wp := workerpool.New(2)
	requests := []string{"alpha", "beta", "gamma", "delta", "epsilon"}

	for _, r := range requests {
		r := r
		wp.Submit(func() {
			fmt.Println("Handling request:", r)
		})
	}

	wp.StopWait()
}