co

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PoolJobs

func PoolJobs(jobs []Job, concurrency int, stopOnErr bool, retHandler func(job Job, ret interface{}, err error))

PoolJobs execute jobs concurrently with limited concurrency, you can stop on error or ignore errors and proceed on.

func PoolJobsEx added in v1.2.2

func PoolJobsEx(jobs chan Job, maxConcurrency int, stopOnErr bool, retHandler func(job Job, ret interface{}, err error))

PoolJobsEx get job from channel instead of predefined jobs, jobs channel should be close when no more jobs.

Types

type Job

type Job interface {
	// Run run the current job
	Run() (ret interface{}, err error)
}

Job abstract a job which can be executed by PoolJobs.

Jump to

Keyboard shortcuts

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