concurrency

package
v0.0.0-...-e8b1e36 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WorkerQueue

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

func NewWorkerQueue

func NewWorkerQueue(ctx context.Context, maxWorkers int) *WorkerQueue

func (*WorkerQueue) Go

func (wq *WorkerQueue) Go(f func() error) error

Go starts a Go routine as a worker. If there are already maxWorkers running, it will block until one of them finishes

Remember to redefine variables in a loop before calling Go(). See pkg/repository/sync.go for an example.

func (*WorkerQueue) Wait

func (wq *WorkerQueue) Wait() error

Wait until all workers have finished their work. Any errors returned by workers will be returned by this function.

Jump to

Keyboard shortcuts

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