This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-24
Channels
- # announcements (1)
- # babashka (86)
- # beginners (75)
- # boot-dev (1)
- # cljdoc (18)
- # cljs-dev (1)
- # cljsrn (67)
- # clojure (127)
- # clojure-australia (1)
- # clojure-dev (2)
- # clojure-europe (9)
- # clojure-nl (2)
- # clojure-serbia (2)
- # clojure-spec (11)
- # clojure-uk (14)
- # clojurescript (17)
- # code-reviews (4)
- # conjure (37)
- # core-async (11)
- # datomic (21)
- # emacs (1)
- # helix (36)
- # jobs (6)
- # malli (1)
- # meander (20)
- # re-frame (13)
- # reagent (49)
- # remote-jobs (11)
- # rum (1)
- # sci (1)
- # shadow-cljs (29)
- # sql (17)
- # vim (2)
maybe you should not do that :)
Well, I'm not using []
of course. :) It's just a collection produced by
(map
(fn [item]
(cognitect.aws.client.api.async/invoke ...))
items)
So when items
is empty, it hangs. I can check for it, but wondered that maybe it's worth mentioning in the docstring or checking for it in a/map
given how easy it is to hang the thread with it.if you want to add an ask.clojure question for it I can add a check for that
Will do!
BTW do you have any opinion on the above code and using (a/<!! (a/map vector ...))
to gather the results in order?
Pretty much my first foray into clojure.core.async
, so rather cautious about every step.
not sure a/map is the best tool for that, seems more like a pipeline-async kind of thing
the pipeline fns retain order
Oh, so with pipeline-async
I will be using the :ch
optional argument to aws-async/invoke
, right?
Posted that question: https://ask.clojure.org/index.php/10652/easy-to-hang-the-current-thread-with-map-chs-when-chs-is-empty
yeah, I think you want to give it the channel passed to the async function
But that won't work, unless I call aws-async/invoke
in the function passed as the third argument to pipeline-async
(assuming that even make sense).
After all, multiple calls to aws-async/invoke
with the same channel can result in the results arriving in a different order. So pipeline-async
will preserve the order, but that order will be wrong.
In any case, I will definitely experiment with pipeline-async
, thanks!
sorry, maybe I'm misremembering the details