Suppress cleared unreachable errors until node becomes reachable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ian Gulliver
2026-01-25 19:02:36 -08:00
parent c8be46b739
commit 1eef7319cc

View File

@@ -35,18 +35,20 @@ type portErrorBaseline struct {
}
type ErrorTracker struct {
mu sync.RWMutex
errors map[string]*PortError
baselines map[string]*portErrorBaseline
nextID int
t *Tendrils
mu sync.RWMutex
errors map[string]*PortError
baselines map[string]*portErrorBaseline
suppressedUnreachable map[string]bool
nextID int
t *Tendrils
}
func NewErrorTracker(t *Tendrils) *ErrorTracker {
return &ErrorTracker{
errors: map[string]*PortError{},
baselines: map[string]*portErrorBaseline{},
t: t,
errors: map[string]*PortError{},
baselines: map[string]*portErrorBaseline{},
suppressedUnreachable: map[string]bool{},
t: t,
}
}
@@ -149,6 +151,9 @@ func (e *ErrorTracker) clearErrorLocked(errorID string) bool {
for key, err := range e.errors {
if err.ID == errorID {
if err.ErrorType == ErrorTypeUnreachable {
e.suppressedUnreachable[key] = true
}
delete(e.errors, key)
return true
}
@@ -168,6 +173,11 @@ func (e *ErrorTracker) clearAllErrorsLocked() bool {
defer e.mu.Unlock()
had := len(e.errors) > 0
for key, err := range e.errors {
if err.ErrorType == ErrorTypeUnreachable {
e.suppressedUnreachable[key] = true
}
}
e.errors = map[string]*PortError{}
return had
}
@@ -195,6 +205,11 @@ func (e *ErrorTracker) setUnreachableLocked(node *Node, ip string) bool {
defer e.mu.Unlock()
key := "unreachable:" + node.TypeID + ":" + ip
if e.suppressedUnreachable[key] {
return false
}
if _, exists := e.errors[key]; exists {
return false
}
@@ -225,6 +240,9 @@ func (e *ErrorTracker) clearUnreachableLocked(node *Node, ip string) bool {
defer e.mu.Unlock()
key := "unreachable:" + node.TypeID + ":" + ip
delete(e.suppressedUnreachable, key)
if _, exists := e.errors[key]; exists {
delete(e.errors, key)
return true