Fork me on GitHub
#clara
<
2020-09-22
>
yenda16:09:08

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

sparkofreason18:09:19

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.

yenda21:09:26

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

ethanc21:09:41

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

yenda21:09:13

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?

ethanc21:09:39

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