mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-07 20:38:51 +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) {
|
func ManageZombies(ctx context.Context, peerUpdate chan *models.Node) {
|
||||||
logger.Log(2, "Zombie management started")
|
logger.Log(2, "Zombie management started")
|
||||||
go InitializeZombies()
|
go InitializeZombies()
|
||||||
|
go checkPendingRemovalNodes()
|
||||||
// Zombie Nodes Cleanup Four Times a Day
|
// Zombie Nodes Cleanup Four Times a Day
|
||||||
ticker := time.NewTicker(time.Hour * ZOMBIE_TIMEOUT)
|
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)
|
// InitializeZombies - populates the zombie quarantine list (should be called from initialization)
|
||||||
func InitializeZombies() {
|
func InitializeZombies() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue