Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultConcurrency = 30
Variables ¶
This section is empty.
Functions ¶
func Collect ¶
func Collect[T any](ctx context.Context, concurrency int, fns ...func() (T, error)) (returns []T, errs []error)
Collect runs fns in parallel with a maximum concurrency of concurrency. The response of running fns[i] is placed into returns[i] or errs[i]. If ctx is done before all fns have finished, the ctx err is placed into errs[i] for each incomplete fn.
func InParallel ¶
InParallel runs fns in parallel with a maximum concurrency of concurrency. The ctx parameter can be used to cancel the start of new fns. Cancellation of running fns is the responsibility of the caller. InParallel returns once all started fns have finished or ctx is done.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.