This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-08
Channels
- # aleph (52)
- # beginners (74)
- # boot (8)
- # cider (4)
- # clara (3)
- # cljs-dev (1)
- # cljsjs (2)
- # cljsrn (1)
- # clojars (2)
- # clojure (300)
- # clojure-argentina (1)
- # clojure-dev (9)
- # clojure-italy (10)
- # clojure-nl (1)
- # clojure-russia (77)
- # clojure-sg (9)
- # clojure-spec (38)
- # clojure-uk (70)
- # clojurescript (108)
- # core-async (12)
- # cursive (9)
- # data-science (4)
- # datascript (7)
- # datomic (37)
- # defnpodcast (4)
- # emacs (11)
- # graphql (6)
- # jobs (3)
- # jobs-discuss (1)
- # juxt (3)
- # keechma (1)
- # klipse (4)
- # lein-figwheel (1)
- # lumo (1)
- # off-topic (3)
- # om (5)
- # onyx (10)
- # parinfer (3)
- # pedestal (1)
- # perun (1)
- # protorepl (3)
- # re-frame (35)
- # reagent (19)
- # spacemacs (4)
- # specter (2)
- # uncomplicate (279)
- # unrepl (32)
anyone have suggestions for what to do when you have to call blocking IO within a go
block? So far my idea is to submit the blocking task to a thread pool but I am not sure how to handle the situation if the theadpool gets overwhelmed and have to deal with RejectedExecutionException(s)
The correct answer to that is "Don't do that"...
i don't think that's the correct answer, unless core.async is significantly less practical than I thought, other similar tools allow blocking io workarounds, for example vertx
What you suggested isn't a bad idea, create a pool to do the blocking IO, then communicate with the pool using channels
and if you want to do blocking io in a go-like context you can spin up a new Java thread via core.async/thread
that approach is what Vert.X is doing, they're spinning up a new thread and running the blocking code in that thread
@tbaldridge thanks, any tips on doing error handling in that scenario?
What you're looking at here is a Call/Response setup, in general I try to avoid this sort of thing
instead I try to structure my core.async code as a pipeline, perhaps with async/pipeline
,
in this case you would flow values into the pipeline and you'd get out {:value ...} {:error "...."}