Fork me on GitHub
#missionary
<
2022-01-16
>
Panel06:01:08

(let [sem (m/sem 2)]
  (m/ap
   (let [batch (m/?= (->> (fetch-ids)
                          (m/eduction (partition-all 20))))]
     (m/holding sem (->> (fetch-projects batch)
                         (m/reduce conj [])
                         m/?)))))
Would that be the way to go to run 2 request (fetch-projects) in parallel ? I first fetch all ids then group them by 20 and fire the request in parallel but max 2 at a time.

👍 1
leonoel17:01:08

it may work for you, depending on your expectations wrt backpressure

leonoel17:01:37

could you post the full problem ? I'd like to think about it

leonoel17:01:59

https://gist.github.com/leonoel/4b7e8c26ffdbfb4e4ffcb79aaf9dccfa This approach may be a better fit, backpressure is propagated from downstream to parallel processors and from parallel processors to upstream