concurrency

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJobsFromStrings added in v1.8.0

func CreateJobsFromStrings(values []string) []interface{}

CreateJobsFromStrings is an utility to create jobs from an slice of strings.

func ForEach added in v1.8.0

func ForEach(ctx context.Context, jobs []interface{}, concurrency int, jobFunc func(ctx context.Context, job interface{}) error) error

ForEach runs the provided jobFunc for each job up to concurrency concurrent workers. The execution breaks on first error encountered.

func ForEachUser

func ForEachUser(ctx context.Context, userIDs []string, concurrency int, userFunc func(ctx context.Context, userID string) error) error

ForEachUser runs the provided userFunc for each userIDs up to concurrency concurrent workers. In case userFunc returns error, it will continue to process remaining users but returns an error with all errors userFunc has returned.

Types

type SyncBuffer

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

func (*SyncBuffer) String

func (sb *SyncBuffer) String() string

func (*SyncBuffer) Write

func (sb *SyncBuffer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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