Documentation
¶
Overview ¶
Command parallel-batch shows how to fan a workflow out over many items that run in parallel, while capping how many run at once.
DATABASE_URL=postgres://localhost:5432/river_dev?sslmode=disable \
go run ./examples/parallel-batch
Because Execute returns immediately, dispatching every item before awaiting any of them runs them concurrently. To bound the concurrency, the item activities are dispatched onto a dedicated queue whose MaxWorkers is the limit: River runs at most that many at a time, as a sliding window, so N items with a limit of K and each taking T finish in roughly ceil(N/K)*T instead of N*T.
Click to show internal directories.
Click to hide internal directories.