Refactor error tracking to be edge-triggered with node setters

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ian Gulliver
2026-01-28 23:06:26 -08:00
parent ed9a0cd60d
commit 99083ecde5
7 changed files with 150 additions and 243 deletions

View File

@@ -169,7 +169,7 @@ func (t *Tendrils) pingNode(node *Node) {
if anyReachable {
t.ping.failures[nodeID] = 0
t.ping.mu.Unlock()
if t.errors.ClearUnreachable(node) {
if node.SetUnreachable(false) {
log.Printf("[ping] %s is now reachable", nodeName)
}
} else {
@@ -177,7 +177,7 @@ func (t *Tendrils) pingNode(node *Node) {
failures := t.ping.failures[nodeID]
t.ping.mu.Unlock()
if failures >= pingFailureThreshold {
if t.errors.SetUnreachable(node) {
if node.SetUnreachable(true) {
log.Printf("[ping] %s is now unreachable", nodeName)
}
}