Fork me on GitHub

Is there a way to have async code in the LHS of a rule? It looks like because a go block returns immediately, if one tries to insert! a fact in the go block on the LHS of a rule, the insert throws an error because the context is gone


Pretty sure the answer is "no". Why do you want a go-block in the LHS? Maybe there's another way to accomplish what you need.


I need to do some async calls to get some info from an api


Doing stateful things within the rules themselves can lead to bizzare behaviors


if I can't do it I suppose the way around that is to insert a fact that will describe the api call that needs to be done, query for that fact, insert more fact based on that result then fire rules again?

👍 3

that would likely be the recommended approach, clara works on the presence or absence of non mutating facts and assertions. When stuff starts changing beneath it, truth maintenance starts to break down

👍 6