remove pending delete nodes

This commit is contained in:
abhishek9686 2025-03-31 19:05:47 +04:00
parent 99e1e20d4f
commit ded348a320

View file

@ -77,7 +77,7 @@ func checkForZombieHosts(h *models.Host) {
func ManageZombies(ctx context.Context, peerUpdate chan *models.Node) {
logger.Log(2, "Zombie management started")
go InitializeZombies()
go checkPendingRemovalNodes()
// Zombie Nodes Cleanup Four Times a Day
ticker := time.NewTicker(time.Hour * ZOMBIE_TIMEOUT)
@ -138,6 +138,15 @@ func ManageZombies(ctx context.Context, peerUpdate chan *models.Node) {
}
}
}
func checkPendingRemovalNodes() {
nodes, _ := GetAllNodes()
for _, node := range nodes {
pendingDelete := node.PendingDelete || node.Action == models.NODE_DELETE
if pendingDelete {
DeleteNode(&node, true)
}
}
}
// InitializeZombies - populates the zombie quarantine list (should be called from initialization)
func InitializeZombies() {