0
votes

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 {}))
1

1 Answers

1
votes

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.