Hi everyone I have a (probably very simple) question How can I use mult asynchronize?
Hi @tajoddin.shima not sure I understand your question, some example illustrating your issue would help. Maybe keep mind this tip: https://clojuredocs.org/clojure.core.async/mult#example-563432f8e4b0290a56055d17?
I'm not sure how you can avoid this situation entirely unless you tap into the source before core.async. The doc also says so: > Use buffering/windowing to prevent slow taps from holding up the mult.
And even if you post to two different channel, you would need to decide what the source should do when one blocks.
so overall you need to review the constraints you can afford in terms of lost data and or blocked thread
or you may want to consider some durable queue
for example: https://www.reddit.com/r/Clojure/comments/cbv9yh/tape_when_kafka_is_too_much_and_durablequeue_not/
thanks for your answer 🙂 @fmjrey
Am I right in assuming that an alts!
where all entries are [channel-to-put-to val-to-put]
, all val-to-put being identical, it will choose the channel-to-put-to that becomes available first?
Hmm nevermind, I can't do what I want with that anyway... I'd need a variable amount of such vectors.
it is correct that alts will proceed with the first available operation @zilti
I basically need it as a simple "load balancer"
alts can take a dynamic set of channel ops as an argument
Ah nice
(unlike alt, which is a macro, or select in go)
see the core async code itself for examples of alts with dynamic args
What I have now is (async/alts! (map (fn [browser] [browser payload]) @browserpool*))
it has to be a vector though
so mapv, not map
corrected 🙂
Wow, it seems to work as expected 😄