This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-14
Channels
- # beginners (19)
- # boot (11)
- # cider (59)
- # cljs-dev (292)
- # cljsrn (2)
- # clojure (121)
- # clojure-brasil (19)
- # clojure-canada (2)
- # clojure-france (2)
- # clojure-italy (57)
- # clojure-spec (54)
- # clojure-uk (20)
- # clojurescript (83)
- # core-async (20)
- # cursive (5)
- # datascript (2)
- # datomic (10)
- # duct (25)
- # editors (4)
- # emacs (2)
- # fulcro (5)
- # funcool (1)
- # graphql (2)
- # immutant (8)
- # java (1)
- # jobs (4)
- # jvm (1)
- # keechma (5)
- # luminus (10)
- # off-topic (113)
- # om (36)
- # onyx (11)
- # parinfer (55)
- # pedestal (7)
- # protorepl (28)
- # re-frame (25)
- # reagent (6)
- # ring-swagger (1)
- # shadow-cljs (113)
- # spacemacs (1)
- # specter (23)
- # unrepl (8)
- # yada (8)
@noisesmith I'm still unsure about the validity of my approach, waiting on feedback
hey @pyr, I answered your mailing list post there but I do hope to look at some async stuff in the near future (but it still might be a few weeks before I get there)
Hi @alexmiller, thanks so much
@pyr If I'm understand the problem I think this is by design. Closing a channel results in a logical termination value being put into the channel.
This is so that, by default, core.async won't loose data.
Most of the time when I encounter this problem I fix it by draining the channel:
(defn drain [c]
(go (while (not (nil? (<! c)))
nil)))
And then:
(close! c)
(drain c)
@tbaldridge so If I read you right, a put!
having its callback never called, or a >!!
blocking forever if a close!
occurs but no drain
is expected
Right, the way to think of it is a close!
acts like a termination message that gets enqueued into the channel. Thus the channel won't be completely closed until that message is processed. Internally it doesn't work that way at all, but it's a good mental picture that works.
Yes, it's annoying, but I've run into several cases where if it didn't work this way, you'd have some nasty race-conditions and data loss.