skip transitiionn if we are already in the desired state
All checks were successful
Lint / golangci-lint (push) Successful in 9m46s
Machine Tests / test (push) Successful in 38s

This commit is contained in:
Matthew Rich 2024-05-16 20:37:15 -07:00
parent 51b3a21aca
commit 36f18d6e31

View File

@ -25,6 +25,9 @@ func NewTransition(trigger string, source State, dest State) Transitioner {
func (r *Transition) Run(m Modeler) error {
currentState := m.InspectState()
if currentState == r.dest {
return nil
}
if currentState == r.source || r.source == "*" {
res := m.ChangeState(r.dest)
if res == currentState {