lib/promscrape/discovery: remove superflouos check in registerPendingAPIWatchers

The check `_, ok := uw.aws[aw]; !ok` isn't needed, since aw cannot exist in uw.aws
because of the check inside subscribeAPIWatcher
This commit is contained in:
Aliaksandr Valialkin 2021-04-07 13:07:36 +03:00
parent 3ec6639bbb
commit 59f9960992

View file

@ -437,10 +437,8 @@ func (uw *urlWatcher) registerPendingAPIWatchers() {
for aw := range uw.awsPending {
awsPending = append(awsPending, aw)
delete(uw.awsPending, aw)
if _, ok := uw.aws[aw]; !ok {
uw.aws[aw] = struct{}{}
}
}
uw.reloadScrapeWorksForAPIWatchers(awsPending, uw.objectsByKey)
uw.mu.Unlock()
metrics.GetOrCreateCounter(fmt.Sprintf(`vm_promscrape_discovery_kubernetes_subscribers{role=%q,status="working"}`, uw.role)).Add(len(awsPending))