Documentation
¶
Overview ¶
Package parallel provides bounded fan-out over an index range — the project's house pattern for running independent work (per-tenant maintenance, per-shard scatter-gather, WAL fsyncs) concurrently under a cap, without pulling in an errgroup dependency. Callers collect results/errors into per-index slots, mirroring the existing query/scale split fan-out.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLimit ¶
func DefaultLimit() int
DefaultLimit is a sane concurrency cap for I/O-bound fan-out: enough to overlap backend round-trips without swamping the object store or the scheduler.
func ForEach ¶
ForEach invokes fn(0), …, fn(n-1), running at most limit concurrently (limit ≤ 0 or ≥ n ⇒ all at once), and returns once every call has completed. Calls for distinct i run on different goroutines, so fn must not mutate shared state without its own synchronization; writing to a per-index slot (e.g. results[i], errs[i]) is the intended pattern and needs none. A worker spawns exactly min(n, limit) goroutines and distributes indices via an atomic counter.
Types ¶
This section is empty.