From 5371736d7852da0dd1bf64ee24e03a9827edb3cc Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Tue, 22 Jul 2025 10:31:37 +0530 Subject: [PATCH] check for node connectivity status --- logic/zombie.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/logic/zombie.go b/logic/zombie.go index 45c769d6..862e732a 100644 --- a/logic/zombie.go +++ b/logic/zombie.go @@ -14,7 +14,7 @@ const ( // ZOMBIE_TIMEOUT - timeout in hours for checking zombie status ZOMBIE_TIMEOUT = 6 // ZOMBIE_DELETE_TIME - timeout in minutes for zombie node deletion - ZOMBIE_DELETE_TIME = 120 + ZOMBIE_DELETE_TIME = 10 ) var ( @@ -139,7 +139,10 @@ func ManageZombies(ctx context.Context, peerUpdate chan *models.Node) { if servercfg.IsAutoCleanUpEnabled() { nodes, _ := GetAllNodes() 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 { continue } @@ -168,8 +171,8 @@ func checkPendingRemovalNodes(peerUpdate chan *models.Node) { peerUpdate <- &node continue } - if servercfg.IsAutoCleanUpEnabled() { - if time.Since(node.LastCheckIn) > time.Minute*ZOMBIE_DELETE_TIME { + if servercfg.IsAutoCleanUpEnabled() && node.Connected { + if time.Since(node.LastCheckIn) > time.Hour*2 { if err := DeleteNode(&node, true); err != nil { continue }