my main idea is adding the ability to close channel with an error and an additional option or specific exception handler that leaves the user the option to close the channel with an error when the error is happening on the provided transducer. This also will make blocking take operations throw the exception and nonblocking returning rejected promise
that's the direction i was thinking in too
hmm - i have an issue with CSP stream transducers - looks like the finaliser arity is not getting called, which is causing some data to sometimes go missing with stateful transducers ... will investigate further
my test passes if i remove the (zero? (mlist/size @puts)) clause so that (add-fn buf) (which is the finaliser arity of any transducer) is always called on close! when there is a buffer ...
https://github.com/funcool/promesa/blob/master/src/promesa/exec/csp/channel.cljc#L333
what does that clause guard against ? i'm not yet sure of the consequences of removing it or changing it...
that looks like legacy, when I have initially look on how core.async worked, because of the other topic we have talked previously: core.async does not clears the put queue. So this looks like a bug, and this condition should be removed
i guess this when is responsible of your bug
i'm right now a bit busy, but as soon as I return to promesa code I will fix it.
That when probably should be replaced with:
(some-> buf add-fn)yep - bug goes away when that bad clause is removed
thanks for confirming, I will remove it as soon as I return to promesa codebase
cool - dyu want me to do a PR ?
if you have time for it, i'm glad to accept it
here u go - clj CI is broken, but it's broken on trunk too https://github.com/funcool/promesa/pull/135
yep, I know it is broken, don't worry i will fix that on my next promesa iteration 😛