limitgroup

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

README

LimitGroup

GoDoc License

An errgroup with concurrency limits.

Documentation

Overview

Package limitgroup provides a control structure for a group of goroutines with configurable concurrency (max number of goroutines to run in parallel).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	// contains filtered or unexported fields
}

Group is a concurrency-limiting errgroup.

func New

func New(ctx context.Context, concurrency int) (*Group, context.Context)

New inits a new group with a given concurrency (default: 1).

func (*Group) Go

func (g *Group) Go(fn func() error)

Go runs a function as part of the group. If group's context is cancelled, this is a no-op.

func (*Group) Wait

func (g *Group) Wait() error

Wait waits for all the group functions to exit and returns the first error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL