skip transitiionn if we are already in the desired state
This commit is contained in:
parent
51b3a21aca
commit
36f18d6e31
@ -25,6 +25,9 @@ func NewTransition(trigger string, source State, dest State) Transitioner {
|
|||||||
|
|
||||||
func (r *Transition) Run(m Modeler) error {
|
func (r *Transition) Run(m Modeler) error {
|
||||||
currentState := m.InspectState()
|
currentState := m.InspectState()
|
||||||
|
if currentState == r.dest {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if currentState == r.source || r.source == "*" {
|
if currentState == r.source || r.source == "*" {
|
||||||
res := m.ChangeState(r.dest)
|
res := m.ChangeState(r.dest)
|
||||||
if res == currentState {
|
if res == currentState {
|
||||||
|
Loading…
Reference in New Issue
Block a user