@@ -34,18 +34,6 @@ func (e *FailoverGroupError) IsStrict() bool {
3434 return e .isStrict
3535}
3636
37- func cacheCleaner (cache * queryCache , interval time.Duration , quit chan bool ) {
38- ticker := time .NewTicker (interval )
39- for {
40- select {
41- case <- quit :
42- return
43- case <- ticker .C :
44- cache .gc ()
45- }
46- }
47- }
48-
4937type disabledChecks struct {
5038 // Key is the name of the unsupported API, value is the list of checks disabled because of it.
5139 apis map [string ][]string
@@ -77,13 +65,11 @@ type FailoverGroup struct {
7765 servers []* Prometheus
7866 uptimeMetric string
7967 cacheCollector * cacheCollector
80- quitChan chan bool
81-
82- pathsInclude []* regexp.Regexp
83- pathsExclude []* regexp.Regexp
84- tags []string
85- started bool
86- strictErrors bool
68+ pathsInclude []* regexp.Regexp
69+ pathsExclude []* regexp.Regexp
70+ tags []string
71+ started bool
72+ strictErrors bool
8773}
8874
8975func NewFailoverGroup (name , uri string , servers []* Prometheus , strictErrors bool , uptimeMetric string , include , exclude []* regexp.Regexp , tags []string ) * FailoverGroup {
@@ -188,8 +174,6 @@ func (fg *FailoverGroup) StartWorkers(reg *prometheus.Registry) {
188174 }
189175
190176 queryCache := newQueryCache (time .Hour , time .Now )
191- fg .quitChan = make (chan bool )
192- go cacheCleaner (queryCache , time .Minute * 2 , fg .quitChan )
193177
194178 fg .cacheCollector = newCacheCollector (queryCache , fg .name )
195179 reg .MustRegister (fg .cacheCollector )
@@ -205,10 +189,9 @@ func (fg *FailoverGroup) Close(reg *prometheus.Registry) {
205189 return
206190 }
207191 reg .Unregister (fg .cacheCollector )
208- fg .quitChan <- true
209192}
210193
211- func (fg * FailoverGroup ) CleanCache () {
194+ func (fg * FailoverGroup ) GC () {
212195 for _ , prom := range fg .servers {
213196 if prom .cache != nil {
214197 prom .cache .gc ()
0 commit comments