Revert "Add missing node tracking for config-defined nodes"
This reverts commit 9ec193ef1d.
This commit is contained in:
57
errors.go
57
errors.go
@@ -9,11 +9,10 @@ import (
|
||||
type PortErrorType string
|
||||
|
||||
const (
|
||||
ErrorTypeStartup PortErrorType = "startup"
|
||||
ErrorTypeNew PortErrorType = "new"
|
||||
ErrorTypeUnreachable PortErrorType = "unreachable"
|
||||
ErrorTypeStartup PortErrorType = "startup"
|
||||
ErrorTypeNew PortErrorType = "new"
|
||||
ErrorTypeUnreachable PortErrorType = "unreachable"
|
||||
ErrorTypeHighUtilization PortErrorType = "high_utilization"
|
||||
ErrorTypeMissing PortErrorType = "missing"
|
||||
)
|
||||
|
||||
type PortError struct {
|
||||
@@ -328,53 +327,3 @@ func (e *ErrorTracker) clearUnreachableLocked(node *Node) (changed bool, becameR
|
||||
}
|
||||
return becameReachable, becameReachable
|
||||
}
|
||||
|
||||
func (e *ErrorTracker) SetMissing(node *Node) {
|
||||
changed := e.setMissingLocked(node)
|
||||
if changed {
|
||||
e.t.NotifyUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
func (e *ErrorTracker) setMissingLocked(node *Node) bool {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
|
||||
key := "missing:" + node.TypeID
|
||||
|
||||
if _, exists := e.errors[key]; exists {
|
||||
return false
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
e.nextID++
|
||||
e.errors[key] = &PortError{
|
||||
ID: fmt.Sprintf("err-%d", e.nextID),
|
||||
NodeTypeID: node.TypeID,
|
||||
NodeName: node.DisplayName(),
|
||||
PortName: "",
|
||||
ErrorType: ErrorTypeMissing,
|
||||
FirstSeen: now,
|
||||
LastUpdated: now,
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *ErrorTracker) ClearMissing(node *Node) {
|
||||
changed := e.clearMissingLocked(node)
|
||||
if changed {
|
||||
e.t.NotifyUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
func (e *ErrorTracker) clearMissingLocked(node *Node) bool {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
|
||||
key := "missing:" + node.TypeID
|
||||
if _, exists := e.errors[key]; exists {
|
||||
delete(e.errors, key)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user