notifyQuerierShutdown records that a querier has sent notification about a graceful shutdown.
(querierID string)
| 314 | |
| 315 | // notifyQuerierShutdown records that a querier has sent notification about a graceful shutdown. |
| 316 | func (q *queues) notifyQuerierShutdown(querierID string) { |
| 317 | info := q.queriers[querierID] |
| 318 | if info == nil { |
| 319 | // The querier may have already been removed, so we just ignore it. |
| 320 | return |
| 321 | } |
| 322 | |
| 323 | // If there are no more connections, we should remove the querier. |
| 324 | if info.connections == 0 { |
| 325 | q.removeQuerier(querierID) |
| 326 | return |
| 327 | } |
| 328 | |
| 329 | // Otherwise we should annotate we received a graceful shutdown notification |
| 330 | // and the querier will be removed once all connections are unregistered. |
| 331 | info.shuttingDown = true |
| 332 | } |
| 333 | |
| 334 | // forgetDisconnectedQueriers removes all disconnected queriers that have gone since at least |
| 335 | // the forget delay. Returns the number of forgotten queriers. |