Documentation
¶
Index ¶
- func HandleError(errc <-chan error, handler func(error))
- func Run(tasks ...Task) <-chan error
- func RunForever(ctx context.Context, concurrent int, task Task) <-chan error
- func RunLimited(ctx context.Context, concurrent int, count int, task Task) <-chan error
- func Wait(errc <-chan error) error
- type Task
- type TaskPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleError ¶
HandleError sets a handler function to be called anytime an error is received on the given channel.
func RunForever ¶
RunForever will execute the given task repeatedly on a set number of goroutines and return any errors. Context can be used to cancel execution of additional tasks.
func RunLimited ¶
RunLimited will execute the given task a set number of times on a set number of goroutines and return any errors. Total times the task will be executed is equal to concurrent multiplied by count. Context can be used to cancel execution of additional tasks.
Types ¶
type TaskPool ¶
type TaskPool struct {
// contains filtered or unexported fields
}
TaskPool limits the number of concurrent tasks being processed to a given max.
func NewTaskPool ¶
NewTaskPool creates a new task pool that will limit concurrent tasks to max.