Problem
A common use case is running N parallel validation tasks where any single "reject" result should immediately short-circuit the remaining tasks. This is different from Promise.race() (first to finish wins) — it is about early termination based on a business logic outcome.
CompletionConfig and completion strategies can be used here, and the toleratedFailureCount parameter can serve as a workaround (treating a reject as a thrown error to trigger early completion), but this pattern is not documented.
Current state
The parallel operations docs document CompletionConfig and mechanical completion modes, but there is no recipe or pattern for "short-circuit on business logic." The toleratedFailureCount workaround is not documented as a pattern.
Suggested improvement
- Add a pattern/recipe to the best practices or patterns docs: "Early termination of parallel tasks based on business logic"
- Document the
toleratedFailureCount workaround with a concrete example (e.g., a content validation engine with checks that may involve long-running IO)
- Consider linking to the
parallel-race CDK example if publicly available
Problem
A common use case is running N parallel validation tasks where any single "reject" result should immediately short-circuit the remaining tasks. This is different from
Promise.race()(first to finish wins) — it is about early termination based on a business logic outcome.CompletionConfigand completion strategies can be used here, and thetoleratedFailureCountparameter can serve as a workaround (treating a reject as a thrown error to trigger early completion), but this pattern is not documented.Current state
The parallel operations docs document
CompletionConfigand mechanical completion modes, but there is no recipe or pattern for "short-circuit on business logic." ThetoleratedFailureCountworkaround is not documented as a pattern.Suggested improvement
toleratedFailureCountworkaround with a concrete example (e.g., a content validation engine with checks that may involve long-running IO)parallel-raceCDK example if publicly available