remove resetting of manager properties and init manager props under locking (#5979)

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
This commit is contained in:
Harkishen Singh 2019-09-06 16:16:24 +05:30 committed by Simon Pasquier
parent a5a4214f31
commit d98d4a9bf0
1 changed files with 3 additions and 3 deletions

View File

@ -191,6 +191,9 @@ func (m *Manager) ApplyConfig(cfg map[string]sd_config.ServiceDiscoveryConfig) e
} }
} }
m.cancelDiscoverers() m.cancelDiscoverers()
m.targets = make(map[poolKey]map[string]*targetgroup.Group)
m.providers = nil
m.discoverCancel = nil
for name, scfg := range cfg { for name, scfg := range cfg {
m.registerProviders(scfg, name) m.registerProviders(scfg, name)
discoveredTargets.WithLabelValues(m.name, name).Set(0) discoveredTargets.WithLabelValues(m.name, name).Set(0)
@ -280,9 +283,6 @@ func (m *Manager) cancelDiscoverers() {
for _, c := range m.discoverCancel { for _, c := range m.discoverCancel {
c() c()
} }
m.targets = make(map[poolKey]map[string]*targetgroup.Group)
m.providers = nil
m.discoverCancel = nil
} }
func (m *Manager) updateGroup(poolKey poolKey, tgs []*targetgroup.Group) { func (m *Manager) updateGroup(poolKey poolKey, tgs []*targetgroup.Group) {