A while back, with the kind help of this channel, I have created catching-transduce
, which is similar to transduce but checks for Throwable
in the input channel and catches exceptions during the transformation / reduction step and returns the exception if any. Feedback welcome. https://gist.github.com/holyjak/61d89610e488f31d8c53b8bbbad299c1
I have to admit it was a real struggle to make sure that it never hangs....
I find that it is a bit of unfortunate that as/pipe
returns it's to
channel. Would be nice if it had the same semantics like pipeline function which allows it to be awaited for when the pipeline is done.
I agree, luckily it's easy to define your own pipe by copying the original https://github.com/clojure/core.async/blob/v0.2.395/src/main/clojure/clojure/core/async.clj#L460
even better you can do:
(as/pipeline 1 o-chan (map identity) i-chan)
Personally I use pipe
more often for ongoing processes and do take advantage of the fact that it returns a channel somewhat frequently