MCPcopy
hub / github.com/grafana/dskit / closeClient

Method closeClient

ring/client/pool.go:178–188  ·  view source on GitHub ↗
(addr string, client PoolClient)

Source from the content-addressed store, hash-verified

176}
177
178func (p *Pool) closeClient(addr string, client PoolClient) {
179 if p.clientsMetric != nil {
180 p.clientsMetric.Add(-1)
181 }
182 // Close in the background since this operation may take awhile and we have a mutex
183 go func(addr string, closer PoolClient) {
184 if err := closer.Close(); err != nil {
185 level.Error(p.logger).Log("msg", fmt.Sprintf("error closing connection to %s", p.clientName), "addr", addr, "err", err)
186 }
187 }(addr, client)
188}
189
190// RemoveClient removes the client instance from the pool if it is still there and not cleaned up by health check.
191// The value of client needs to be the same as returned by GetClientForInstance or GetClientFor.

Callers 2

RemoveClientForMethod · 0.95
RemoveClientMethod · 0.95

Calls 4

AddMethod · 0.65
CloseMethod · 0.65
LogMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected