mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
simplify the pool cleanup
This commit is contained in:
parent
a981b51900
commit
a535c8d1b4
|
@ -146,20 +146,15 @@ func (m *ScrapeManager) reload(t map[string][]*targetgroup.Group) error {
|
||||||
} else {
|
} else {
|
||||||
existing.Sync(tgroup)
|
existing.Sync(tgroup)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup - check the config and cancel the scrape loops if it don't exist in the scrape config.
|
|
||||||
jobs := make(map[string]struct{})
|
|
||||||
|
|
||||||
for k := range m.scrapeConfigs {
|
|
||||||
jobs[k] = struct{}{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cleanup - check the config and cancel the scrape loops if it don't exist in the scrape config.
|
||||||
for name, sp := range m.scrapePools {
|
for name, sp := range m.scrapePools {
|
||||||
if _, ok := jobs[name]; !ok {
|
if _, ok := m.scrapeConfigs[name]; !ok {
|
||||||
sp.stop()
|
sp.stop()
|
||||||
delete(m.scrapePools, name)
|
delete(m.scrapePools, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue