Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultParallelism is the default parallelism used in scheduler. DefaultParallelism int = 16 )
Variables ¶
This section is empty.
Functions ¶
func ParallelizeUntil ¶
func ParallelizeUntil(ctx context.Context, workers, pieces int, doWorkPiece DoWorkPieceFunc, opts ...Options)
ParallelizeUntil is a framework that allows for parallelizing N independent pieces of work until done or the context is canceled.
func WithChunkSize ¶
func WithChunkSize(c int) func(*options)
WithChunkSize allows to set chunks of work items to the workers, rather than processing one by one. It is recommended to use this option if the number of pieces significantly higher than the number of workers and the work done for each item is small.
Types ¶
type Config ¶
func DefaultConfig ¶
func DefaultConfig() *Config
type DoWorkPieceFunc ¶
type DoWorkPieceFunc func(int)
Click to show internal directories.
Click to hide internal directories.