--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
What is the buffered channel’s buffer used for? If that’s set to 1 and the channel’s transducer is `(mapcat identity)` then the producer should be able to continuously put chunks of work onto the channel with the puts only completing when the previous chunk is completely consumed.
The work-queue channel has a fixed buffer size of 1. A collection (range 50) is put on the channel. While consumers can take items off the channel — note the individual contents of (range 50) are returned — a producer cannot put another value onto the channel until the entire initial collection is consumed.
You have a channel with a buffer-size of one. You clear the buffer by
taking one item from it, making room for another one. Therefore the put
succeeds. Try just `(async/chan nil xform)` to create a channel without
a backing buffer (a rendezvouz channel) where puts only succeed if
there's a matching consumer.
What about simply having the producer put items one by one on the channel?
I think the behavior in our examples differ because the blocking puts will complete whenever there is a take and the buffer is not full, ignoring whether the transducer is still outputting values. This bug may be relevant, though there it arises in a less common scenario (fixed buffer of size 0, which is now disallowed) https://dev.clojure.org/jira/browse/ASYNC-140
Alex - it makes sense to me that the buffer temporarily expands beyond its normal size with the content of the expanding transducer. What does not make sense to me is the buffer also accepts puts even though its buffer is full.Why would the take! process puts when the channel's buffer is full?I was experimenting with the implementation and I think the patch in this gist leads to more intuitive behavior — though it’s possible it breaks something else. https://gist.github.com/brianru/d30f0319e7a14d875a80762937cccb9c
Thanks! I will. Just signed the CA.
--