parallel-io
parallel-io copied to clipboard
parallelFirst with cancel
At first I thought that parallelFirst
was exactly what I needed for my problem, but unless I'm not using it right (which is very possible), it's just a bit different than I was expecting.
It returns the first result, but all actions are computed, instead of canceling the remaining computations after the first result. Is it supposed to cancel them, and I'm seeing an odd behavior?
Would it match the intended semantics of parallelFirst
if it were changed to this behavior, or would a parallelFirstCancel
be useful? There is an analogous function in async
: waitAnyCancel
, but it doesn't provide the pool mechanics or use Maybe
.