mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-03 02:14:24 +08:00
remove pending delete nodes
This commit is contained in:
parent
99e1e20d4f
commit
ded348a320
1 changed files with 10 additions and 1 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue