Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.async by

Do we want this for consumer walkaway scenarios or something baked into the channel impl?

`
(defn drain!
"Fully consumes and discards a channel. Returns a channel that
closes when ch is fully drained"
[ch]
(go-loop []
(if (some? (<! ch))

 (recur))))

`

2 Answers

0 votes
by

Comment made by: samumbach

When a channel's buffer is full, close! and/or {{untap}} on that channel is not sufficient to unblock other taps on the same mult channel. This is a specific case when drain! is necessary; be sure to drain after untap/close to avoid a race condition.

0 votes
by
Reference: https://clojure.atlassian.net/browse/ASYNC-66 (reported by gshayban)
...