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