Skip to main content
Siglo provides high-performance combinators for concurrent fan-out, competitive racing, conditional routing, and bounded batch processing.

1. Parallel Fan-Out with parallel()

Execute multiple branches or steps concurrently:

Concurrency Modes & Merge Strategies

Configure merge behavior using ParallelOptions:
Branches execute concurrently and merge in branch-list order. Context metadata exposes $branches and $settled. Note that parallel([...]) is unbounded; for bounded concurrency across large collections, use map() below.

2. Competitive Racing with race()

Execute multiple alternatives concurrently and accept the fastest result:

3. Conditional Branching with branch() and when()

Route execution based on runtime conditions:

Boolean Routing with when(predicate, thenStep, elseStep?)

Ideal for binary branching decisions:

Multi-Way Routing with branch(selectorFn, branchesMap, defaultBranch?)

Ideal for dictionary dispatch across named routes:

4. Bounded Batch Mapping with map()

Process collections with controlled concurrency without exhausting memory or database connections:

Minimal Example


Failure Example: Handling Partial Parallel Failures

Using allSettled mode ensures individual step errors do not crash other concurrent operations:

Testing Example


Operational Caveats

  1. Parallel Fan-Out is Unbounded: parallel([...]) initiates all branches simultaneously. When calling external services with limited connection pools, do not use parallel([...]) for large arrays—use map(items, step, { concurrency: N }) to bound concurrent executions.
  2. Key Collisions in Parallel Branches: If parallel branches produce identically named output keys without a custom reducer or namespace strategy, the last resolved branch will overwrite prior ones. Specify { mergeStrategy: 'namespace' } to isolate branch keys.