S7 event-overrun: the hub times each handling, the finding event-overrun, ViewKinds names both
Builds: design 47 H2 H-A-683 (3), H-A-697 (1) (2) (3)
This commit is contained in:
@@ -435,8 +435,29 @@ func (r *ProcessReader) unhandled(subject string) {
|
||||
}
|
||||
}
|
||||
|
||||
// clearUnhandled clears the module's finding `event-unhandled` at the process's start: a new build may handle the event
|
||||
// (H-A-169).
|
||||
// overrun is the event hub's word of the handlings past event-overrun: the module's finding `event-overrun`, written again at
|
||||
// each handling that passes the bound or ends, and cleared once none is past it (design 47 H2 H-A-697 (3)).
|
||||
func (r *ProcessReader) overrun(past []process.Handling) {
|
||||
if r.Findings == nil {
|
||||
return
|
||||
}
|
||||
w := r.Findings()
|
||||
if w == nil {
|
||||
return
|
||||
}
|
||||
if len(past) == 0 {
|
||||
if err := (viewFinding{kind: EventOverrunKind, id: r.Module}).drop(w); err != nil {
|
||||
r.logf("views: the finding %s of %s is not cleared: %v", EventOverrunKind, r.Module, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if err := overrunFinding(r.Module, past, r.now()).put(w); err != nil {
|
||||
r.logf("views: the finding %s of %s is not written: %v", EventOverrunKind, r.Module, err)
|
||||
}
|
||||
}
|
||||
|
||||
// clearUnhandled clears the module's findings `event-unhandled` and `event-overrun` at the process's start: a new build may
|
||||
// handle the event (H-A-169), and no handling of the new process runs yet (H-A-697 (1)).
|
||||
func (r *ProcessReader) clearUnhandled() {
|
||||
if r.Findings == nil {
|
||||
return
|
||||
@@ -445,8 +466,10 @@ func (r *ProcessReader) clearUnhandled() {
|
||||
if w == nil {
|
||||
return
|
||||
}
|
||||
if err := (viewFinding{kind: EventUnhandledKind, id: r.Module}).drop(w); err != nil {
|
||||
r.logf("views: the finding %s of %s is not cleared at its start: %v", EventUnhandledKind, r.Module, err)
|
||||
for _, kind := range []string{EventUnhandledKind, EventOverrunKind} {
|
||||
if err := (viewFinding{kind: kind, id: r.Module}).drop(w); err != nil {
|
||||
r.logf("views: the finding %s of %s is not cleared at its start: %v", kind, r.Module, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -908,6 +931,7 @@ func (r *ProcessReader) Start(ctx context.Context, js jetstream.JetStream, cred
|
||||
r.mu.Unlock()
|
||||
if wire {
|
||||
hub.OnUnhandled(r.unhandled)
|
||||
hub.OnOverrun(r.overrun)
|
||||
}
|
||||
}
|
||||
r.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user