-
-
Notifications
You must be signed in to change notification settings - Fork 64
Description
I'm creating workflow execution using the stateless FSM behind the scene. In the execution I need to keep track of number of transitions, and halt the execution if that count is ever exceeded, in order to prevent runaway situations.
I have a struct to keep track of number of transitions happened in the FSM:
type ResetOperation struct {
fsm *stateless.StateMachine
transitionCount int32
}
To increment transitionCount I'm using OnTransitioning() handler. However, there seems to be no way to return error from the handler function, and calling fsm.Deactive() will not stop the execution.
I could probably fire trigger "maxTransitionsReached" and have an error state in the FSM, but if I understand correctly, firing the trigger will cause it to be put on queue fireModeQueued, and queue might not be empty.
What is proper way to handle this scenario?