Fork me on GitHub

I have a bizarre problem with callback hell, despite using async-flow Let's say I have an event ::fetch-from-x that takes an argument and ::fetch-from-y that also takes an argument, plus y needs data stored by x. When processing [::fetch-from-y "bar"], I check if I have the needed data in the db and if I don't, then:

{:fx [[:async-flow
              {first-dispatch [::fetch-from-x "foo"]
               :rules [{:when :seen?
                                 :events ::fetch-from-x-success
                                 :dispatch [::fetch-y "bar"]
                                 :halt? true}]}]]}
if I call ::fetch-from-y several times with different arguments, async-flow does not allow to check witch ::fetch-from-x event succeeded 😞

AJ Jaro10:07:20

@U0BBFDED7 async-flow keeps track of events that have already ran. With this design it only allows each rule to be run once Someone also to track something similar to what you’re looking to do


Well, I've managed a not so elegant solution, I push the on-success, event after the event, which are all fired in the right order after the data is fetched


Looks bad, works surprisingly well, hope I don't have to touch it again

👍 2