This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-24
Channels
- # beginners (19)
- # boot (118)
- # capetown (4)
- # cider (37)
- # cljs-dev (69)
- # cljsjs (23)
- # clojure (212)
- # clojure-austin (10)
- # clojure-india (3)
- # clojure-italy (2)
- # clojure-mke (1)
- # clojure-nl (1)
- # clojure-russia (5)
- # clojure-spec (52)
- # clojure-uk (86)
- # clojurescript (31)
- # core-async (9)
- # cursive (123)
- # datomic (91)
- # emacs (22)
- # events (3)
- # hoplon (68)
- # klipse (4)
- # lambdaisland (10)
- # leiningen (2)
- # off-topic (14)
- # om (14)
- # onyx (44)
- # perun (14)
- # proton (20)
- # re-frame (15)
- # reagent (10)
- # ring-swagger (9)
- # specter (18)
- # untangled (3)
- # vim (26)
- # yada (4)
one of my coworkers has gotten it to run to completion by changing (>!! out x)
to (go (>! out x))
. so now I’m trying to figure out what’s the normal way to write pipeline functions. another example I found online used a go
block enclosing both >!
and close!
, and the core.async library’s own tests use thread
with blocking >!!
. I have no idea how any of these variations are expected to behave within whatever mysterious context pipeline-async
is orchestrating...
@dalekbaldwin yes, in the context of pipeline-async it expects the function to be "async" meaning, hand off the channel it gives you to some other thread and let that thread do the processing
So something like
(pipeline-async 2 to
(fn [x out]
(http/request x (fn [result]
(put! out result)
(close! out))))
from)
wow, thanks slack for the horrific formatting
oh wow, there’s another aspect I didn’t even notice before. in the code I inherited and in this example I found: https://gist.github.com/JacobNinja/5c98496a632e1a466cbf#file-pipeline-clj-L7-L17 the handler puts on the same channel that is passed to pipeline-async
, then closes the channel that was passed to it directly. in the code you just posted and in the official tests, it puts to and closes the channel that was passed to it directly.
not sure I understand what you're saying.
pipeline-async
is passed out
, and the the handler is passed out*
; the handler puts a value on out
and then closes out*
. but from what I’m seeing now, it looks like you’re just supposed to put values on out*
and then pipeline-async
takes care of redirecting them all to out
.
oh yes, absolutely, you should be putting data on the channel handed to you by the pipeline