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
I have this scenario where the state machine will be frequently triggered/started by an external process (e.g.: a cron-like task manager), which will need to block until whatever asynchronous processing the state machine has been configured to execute finishes. Is this achievable? State would be serialized/persisted and pulled/hydrated back upon every triggered execution. However, I'm not sure how the blocking of the external (controller) process would be handled.
Thanks.
The text was updated successfully, but these errors were encountered:
mpenna
changed the title
How to start and await for a state machine asynchronous execution?
How to start and await for a state machine's asynchronous execution?
Nov 7, 2023
Your finish is "finished" when it hits a final state, a state which has no transitions. What I would probably do is something like this:
letresolve;letpromise=newPromise(_resolve=>{resolve=_resolve;})service=interpret(machine,()=>{if(machine.state.value.final){resolve();}});awaitpromise;// All done!
I have this scenario where the state machine will be frequently triggered/started by an external process (e.g.: a cron-like task manager), which will need to block until whatever asynchronous processing the state machine has been configured to execute finishes. Is this achievable? State would be serialized/persisted and pulled/hydrated back upon every triggered execution. However, I'm not sure how the blocking of the external (controller) process would be handled.
Thanks.
The text was updated successfully, but these errors were encountered: