Fork me on GitHub
#core-async
<
2016-07-04
>
aiba00:07:43

@andrewhr that’s pretty reasonable, could even be implemented as a general function that takes an input channel, creates an intermediary channel with a sliding buffer, and output channel, runs a pair of go loops that do the counting, and returns the output channel. Not sure about the performance implications of adding two intermediary channels like that.

aiba00:07:25

I may just have producer check (pos? (count (.buf c))) before putting onto the channel with a (sliding-buffer 1), and assume if that expr is true, then 1 message will be dropped

danielcompton01:07:48

That’s not thread safe IIRC, but will probably be good enough for an estimate

aiba20:07:36

@danielcompton: yup, there's a possibility that a take happens between checking buf size and putting onto it, but totally good enough for estimate. Thanks everyone for the thoughts!