unregister source when the target is empty
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
This commit is contained in:
parent
ba7eb733e8
commit
9970e4e7e4
|
@ -232,6 +232,11 @@ func (m *Manager) updateGroup(poolKey poolKey, tgs []*targetgroup.Group) {
|
|||
m.targets[poolKey] = make(map[string]*targetgroup.Group)
|
||||
}
|
||||
m.targets[poolKey][tg.Source] = tg
|
||||
|
||||
// Clear the key in the case where the targets is empty.
|
||||
if tg.Targets == nil || len(tg.Targets) <= 0 {
|
||||
delete(m.targets[poolKey], tg.Source)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue