return early for nil target groups
This commit is contained in:
parent
77bf6bece0
commit
546c29af5b
|
@ -154,7 +154,11 @@ func (m *Manager) updateGroup(poolKey poolKey, tgs []*targetgroup.Group) {
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
|
|
||||||
m.actionCh <- func(ctx context.Context) {
|
m.actionCh <- func(ctx context.Context) {
|
||||||
if tgs != nil {
|
if tgs == nil {
|
||||||
|
close(done)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for _, tg := range tgs {
|
for _, tg := range tgs {
|
||||||
if tg != nil { // Some Discoverers send nil targetgroup so need to check for it to avoid panics.
|
if tg != nil { // Some Discoverers send nil targetgroup so need to check for it to avoid panics.
|
||||||
if _, ok := m.targets[poolKey]; !ok {
|
if _, ok := m.targets[poolKey]; !ok {
|
||||||
|
@ -163,7 +167,6 @@ func (m *Manager) updateGroup(poolKey poolKey, tgs []*targetgroup.Group) {
|
||||||
m.targets[poolKey][tg.Source] = tg
|
m.targets[poolKey][tg.Source] = tg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
close(done)
|
close(done)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue