You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pipeline and pipeline-blocking have the same functionality, naming just indicates the performing operation is IO or CPU bound.
(let [c (chan)
out (chan)]
(async/onto-chan c (range10))
;; or async/pipeline
(async/pipeline-blocking5 out (map (fn [x]
(Thread/sleep500)
(inc x))) c)
(<!! (async/into [] out)))
Pipeline-async should be used within async operations:
(defnhttp-get [url c]
(println url)
(http/get url (fn [v]
(put! c v)
(close! c)))
c)
(let [from (chan10 (map (fn [name]
(str"http://imdbapi.poromenos.org/js/?name=%25"
name
"%25"))))
to (chan10 (map (fn [response]
(-> response
:body
(cheshire/parse-stringtrue)))))]
(async/pipeline-async10 to http-get from)
(>!! from "Home")
(println (<!! to)))