From 59f9960992abbbd670acb6a53d10ec9b0378c9c4 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 7 Apr 2021 13:07:36 +0300 Subject: [PATCH] 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 --- lib/promscrape/discovery/kubernetes/api_watcher.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/promscrape/discovery/kubernetes/api_watcher.go b/lib/promscrape/discovery/kubernetes/api_watcher.go index e6c56212b..9e1c80830 100644 --- a/lib/promscrape/discovery/kubernetes/api_watcher.go +++ b/lib/promscrape/discovery/kubernetes/api_watcher.go @@ -437,9 +437,7 @@ 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.aws[aw] = struct{}{} } uw.reloadScrapeWorksForAPIWatchers(awsPending, uw.objectsByKey) uw.mu.Unlock()