parallel-batch

command
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 13 Imported by: 0

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.

Jump to

Keyboard shortcuts

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