next determines whether the next expression in the sequence should be evaluated. The expression is evaluated if all its upstream sequence expression produced a match and the sequence is not stuck in deadline or expired state.
(seqID int)
| 392 | // if all its upstream sequence expression produced a match and |
| 393 | // the sequence is not stuck in deadline or expired state. |
| 394 | func (s *sequenceState) next(seqID int) bool { |
| 395 | // always evaluate the first expression in the sequence |
| 396 | if seqID == 0 { |
| 397 | return true |
| 398 | } |
| 399 | |
| 400 | var next bool |
| 401 | s.smu.RLock() |
| 402 | defer s.smu.RUnlock() |
| 403 | for n := range seqID { |
| 404 | next = s.states[n] |
| 405 | if !next { |
| 406 | break |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | return next && !s.inDeadline.Load() && !s.inExpired.Load() |
| 411 | } |
| 412 | |
| 413 | func (s *sequenceState) scheduleMaxSpanDeadline(seqID fsm.State, maxSpan time.Duration) { |
| 414 | t := time.AfterFunc(maxSpan, func() { |
no outgoing calls