MCPcopy Create free account
hub / github.com/cortexproject/cortex / removeStaleClients

Method removeStaleClients

pkg/ring/client/pool.go:155–174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153}
154
155func (p *Pool) removeStaleClients() {
156 // Only if service discovery has been configured.
157 if p.discovery == nil {
158 return
159 }
160
161 serviceAddrs, err := p.discovery()
162 if err != nil {
163 level.Error(p.logger).Log("msg", "error removing stale clients", "err", err)
164 return
165 }
166
167 for _, addr := range p.RegisteredAddresses() {
168 if slices.Contains(serviceAddrs, addr) {
169 continue
170 }
171 level.Info(p.logger).Log("msg", "removing stale client", "addr", addr)
172 p.RemoveClientFor(addr)
173 }
174}
175
176// cleanUnhealthy loops through all servers and deletes any that fails a healthcheck.
177func (p *Pool) cleanUnhealthy() {

Callers 1

iterationMethod · 0.95

Calls 4

RegisteredAddressesMethod · 0.95
RemoveClientForMethod · 0.95
LogMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected