|
@@ -71,11 +71,15 @@ func GetNodeStatus(node *models.Node, defaultEnabledPolicy bool) {
|
|
if err != nil {
|
|
if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if metrics == nil || metrics.Connectivity == nil {
|
|
|
|
|
|
+ if metrics == nil || metrics.Connectivity == nil || len(metrics.Connectivity) == 0 {
|
|
if time.Since(node.LastCheckIn) < models.LastCheckInThreshold {
|
|
if time.Since(node.LastCheckIn) < models.LastCheckInThreshold {
|
|
node.Status = models.OnlineSt
|
|
node.Status = models.OnlineSt
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if node.LastCheckIn.IsZero() {
|
|
|
|
+ node.Status = models.OfflineSt
|
|
|
|
+ return
|
|
|
|
+ }
|
|
}
|
|
}
|
|
// if node.IsFailOver {
|
|
// if node.IsFailOver {
|
|
// if time.Since(node.LastCheckIn) < models.LastCheckInThreshold {
|
|
// if time.Since(node.LastCheckIn) < models.LastCheckInThreshold {
|
|
@@ -133,9 +137,12 @@ func checkPeerStatus(node *models.Node, defaultAclPolicy bool) {
|
|
if err != nil {
|
|
if err != nil {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
- allowed, _ := logic.IsNodeAllowedToCommunicate(*node, peer, false)
|
|
|
|
- if !defaultAclPolicy && !allowed {
|
|
|
|
- continue
|
|
|
|
|
|
+
|
|
|
|
+ if !defaultAclPolicy {
|
|
|
|
+ allowed, _ := logic.IsNodeAllowedToCommunicate(*node, peer, false)
|
|
|
|
+ if !allowed {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if time.Since(peer.LastCheckIn) > models.LastCheckInThreshold {
|
|
if time.Since(peer.LastCheckIn) > models.LastCheckInThreshold {
|
|
@@ -154,7 +161,7 @@ func checkPeerStatus(node *models.Node, defaultAclPolicy bool) {
|
|
node.Status = models.OnlineSt
|
|
node.Status = models.OnlineSt
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if peerNotConnectedCnt == len(metrics.Connectivity) {
|
|
|
|
|
|
+ if len(metrics.Connectivity) > 0 && peerNotConnectedCnt == len(metrics.Connectivity) {
|
|
node.Status = models.ErrorSt
|
|
node.Status = models.ErrorSt
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -195,7 +202,7 @@ func checkPeerConnectivity(node *models.Node, metrics *models.Metrics, defaultAc
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- if peerNotConnectedCnt == len(metrics.Connectivity) {
|
|
|
|
|
|
+ if len(metrics.Connectivity) > 0 && peerNotConnectedCnt == len(metrics.Connectivity) {
|
|
node.Status = models.ErrorSt
|
|
node.Status = models.ErrorSt
|
|
return
|
|
return
|
|
}
|
|
}
|