You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Find a way to pass a function to state in user-defined update function so that the update can be run async as a Task so subsequent ticks will return :bh_running until the task completes (which sets the resulting status). This makes the agent reactive. Or is there a better more elixir way to do this? I'm thinking similar to this:
defhandle_cast({:run,fun},state)doTask.async(fun)# sends a message back to the automaton when completed{:noreply,state}end# handle_info/2 receives generic messages from the Task processesdefhandle_info({_task,{:ok,result}},state)donew_state=%{state|status: result}{:noreply,new_state}enddefhandle_info({_task,{:error,reason}},state)dostate=%{state|status: :bh_failure,fail_reason: reason}{:noreply,state}end
The text was updated successfully, but these errors were encountered:
Find a way to pass a function to state in user-defined
update
function so that the update can be run async as a Task so subsequent ticks will return :bh_running until the task completes (which sets the resulting status). This makes the agent reactive. Or is there a better more elixir way to do this? I'm thinking similar to this:The text was updated successfully, but these errors were encountered: