Fork me on GitHub

@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.


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


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


@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!