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