Skip to content

Commit

Permalink
fix: prevent double handlerDone notif (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
pancsta authored Jan 18, 2024
1 parent 38954b5 commit 9881009
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/machine/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (m *Machine) When(states []string, ctx context.Context) chan struct{} {
setMap[s] = m.Is(S{s})
if setMap[s] {
matched++
}
}
}
// add the binding to an index of each state
binding := &whenBinding{
Expand Down Expand Up @@ -974,8 +974,9 @@ func (m *Machine) processEmitters(e *Event) Result {
[]reflect.Value{reflect.ValueOf(e)})
if len(callRet) > 0 {
m.handlerDone <- callRet[0].Interface().(bool)
return
}
// handlers returns true by default
// handlers return true by default
m.handlerDone <- true
}()
// wait on the result / timeout / context
Expand Down

0 comments on commit 9881009

Please sign in to comment.