MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / scheduleMaxSpanDeadline

Method scheduleMaxSpanDeadline

pkg/rules/sequence.go:413–437  ·  view source on GitHub ↗
(seqID fsm.State, maxSpan time.Duration)

Source from the content-addressed store, hash-verified

411}
412
413func (s *sequenceState) scheduleMaxSpanDeadline(seqID fsm.State, maxSpan time.Duration) {
414 t := time.AfterFunc(maxSpan, func() {
415 inState, _ := s.fsm.IsInState(seqID)
416 if inState {
417 log.Debugf("max span of %v exceded for expression [%s] of sequence [%s]", maxSpan, s.expr(seqID), s.name)
418 s.inDeadline.Store(true)
419 s.mu.Lock()
420 defer s.mu.Unlock()
421 s.smu.Lock()
422 defer s.smu.Unlock()
423 // transitions to deadline state
424 err := s.cancelTransition(seqID)
425 if err != nil {
426 s.inDeadline.Store(false)
427 log.Warnf("deadline transition failed: %v", err)
428 }
429 // transitions from deadline state to initial state
430 err = s.fsm.Fire(resetTransition)
431 if err != nil {
432 log.Warnf("unable to transition to initial state: %v", err)
433 }
434 }
435 })
436 s.spanDeadlines[seqID] = t
437}
438
439func (s *sequenceState) runSequence(e *event.Event) bool {
440 for i, expr := range s.seq.Expressions {

Callers 1

initFSMMethod · 0.95

Calls 6

exprMethod · 0.95
cancelTransitionMethod · 0.95
StoreMethod · 0.80
LockMethod · 0.80
UnlockMethod · 0.80
FireMethod · 0.80

Tested by

no test coverage detected