mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-13 07:16:31 +08:00
check for node connectivity status
This commit is contained in:
parent
e517a0ac66
commit
5371736d78
1 changed files with 7 additions and 4 deletions
|
@ -14,7 +14,7 @@ const (
|
||||||
// ZOMBIE_TIMEOUT - timeout in hours for checking zombie status
|
// ZOMBIE_TIMEOUT - timeout in hours for checking zombie status
|
||||||
ZOMBIE_TIMEOUT = 6
|
ZOMBIE_TIMEOUT = 6
|
||||||
// ZOMBIE_DELETE_TIME - timeout in minutes for zombie node deletion
|
// ZOMBIE_DELETE_TIME - timeout in minutes for zombie node deletion
|
||||||
ZOMBIE_DELETE_TIME = 120
|
ZOMBIE_DELETE_TIME = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -139,7 +139,10 @@ func ManageZombies(ctx context.Context, peerUpdate chan *models.Node) {
|
||||||
if servercfg.IsAutoCleanUpEnabled() {
|
if servercfg.IsAutoCleanUpEnabled() {
|
||||||
nodes, _ := GetAllNodes()
|
nodes, _ := GetAllNodes()
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
if time.Since(node.LastCheckIn) > time.Minute*ZOMBIE_DELETE_TIME {
|
if !node.Connected {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if time.Since(node.LastCheckIn) > time.Hour*2 {
|
||||||
if err := DeleteNode(&node, true); err != nil {
|
if err := DeleteNode(&node, true); err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -168,8 +171,8 @@ func checkPendingRemovalNodes(peerUpdate chan *models.Node) {
|
||||||
peerUpdate <- &node
|
peerUpdate <- &node
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if servercfg.IsAutoCleanUpEnabled() {
|
if servercfg.IsAutoCleanUpEnabled() && node.Connected {
|
||||||
if time.Since(node.LastCheckIn) > time.Minute*ZOMBIE_DELETE_TIME {
|
if time.Since(node.LastCheckIn) > time.Hour*2 {
|
||||||
if err := DeleteNode(&node, true); err != nil {
|
if err := DeleteNode(&node, true); err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue