Reputation: 147
How can I collect data from a bulk of go
channels? I get assert failed: <! used not in (go ...)
for the code below. I know why I get it, I'm asking what is the best way to consume from all channels.
(->> state :pods (map #(go [(pd/id %)
(<! (f/pod-metrics fleet %))])) (map <!) (into {}))
Upvotes: 0
Views: 99
Reputation: 1976
Use https://clojuredocs.org/clojure.core.async/merge to merge your source channels into one and then use <!!
to take val from it. Note that <!
can only be used inside a go
block.
Upvotes: 1