sourcegraph / conc

Better structured concurrency for go
https://about.sourcegraph.com/blog/building-conc-better-structured-concurrency-for-go
MIT License
9.05k stars 312 forks source link

Add `WithFailFast()` #118

Closed camdencheek closed 1 year ago

camdencheek commented 1 year ago

In https://github.com/sourcegraph/conc/pull/104, a "FailFast" option is likely going to be added to iterators that, on error, stops running additional tasks and returns the error that caused the first failure.

"FailFast" seems is a pretty standard description for this behavior, and combining two common options into a single option with a more discoverable name seems like a nice thing to do before 1.0.

codecov-commenter commented 1 year ago

Codecov Report

Merging #118 (8880a37) into main (8e5ba59) will increase coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
+ Coverage   99.30%   99.32%   +0.01%     
==========================================
  Files          12       12              
  Lines         433      442       +9     
==========================================
+ Hits          430      439       +9     
  Misses          3        3              
Impacted Files Coverage Δ
pool/context_pool.go 100.00% <100.00%> (ø)
pool/result_context_pool.go 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more