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:
4
ping.go
4
ping.go
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user