mirror of
https://github.com/gravitl/netmaker.git
synced 2025-11-03 02:53:29 +08:00
add handling for slice size reduction to for loop
This commit is contained in:
committed by
Matthew R. Kasun
parent
eb3ad7974d
commit
f07a6dcf2f
@@ -47,13 +47,12 @@ func ManageZombies(ctx context.Context) {
|
||||
zombies = append(zombies, id)
|
||||
case id := <-removeZombie:
|
||||
found := false
|
||||
if len(zombies) > 0 {
|
||||
for i := len(zombies) - 1; i <= 0; i-- {
|
||||
if zombies[i] == id {
|
||||
logger.Log(1, "removing zombie from quaratine list", zombies[i])
|
||||
zombies = append(zombies[:i], zombies[i+1:]...)
|
||||
found = true
|
||||
}
|
||||
for i := 0; i < len(zombies); i++ {
|
||||
if zombies[i] == id {
|
||||
logger.Log(1, "removing zombie from quaratine list", zombies[i])
|
||||
zombies = append(zombies[:i], zombies[i+1:]...)
|
||||
found = true
|
||||
i--
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
|
||||
Reference in New Issue
Block a user