lib/vmselectapi: rename Server.MustClose to more clear Server.MustStop

This commit is contained in:
Aliaksandr Valialkin 2022-07-06 00:41:49 +03:00
parent 270e555f47
commit 2e721f7d16
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1
3 changed files with 8 additions and 8 deletions

View File

@ -131,8 +131,8 @@ func main() {
logger.Infof("gracefully shutting down the service")
startTime = time.Now()
stopStaleSnapshotsRemover()
vmselectSrv.MustClose()
vminsertSrv.MustClose()
vmselectSrv.MustStop()
vminsertSrv.MustStop()
common.StopUnmarshalWorkers()
logger.Infof("successfully shut down the service in %.3f seconds", time.Since(startTime).Seconds())

View File

@ -95,7 +95,7 @@ func (s *VMInsertServer) run() {
bc, err := handshake.VMInsertServer(c, compressionLevel)
if err != nil {
if s.isStopping() {
// c is stopped inside VMInsertServer.MustClose
// c is stopped inside VMInsertServer.MustStop
return
}
logger.Errorf("cannot perform vminsert handshake with client %q: %s", c.RemoteAddr(), err)
@ -131,8 +131,8 @@ var (
vminsertMetricsRead = metrics.NewCounter("vm_vminsert_metrics_read_total")
)
// MustClose gracefully closes s so it no longer touches s.storage after returning.
func (s *VMInsertServer) MustClose() {
// MustStop gracefully stops s so it no longer touches s.storage after returning.
func (s *VMInsertServer) MustStop() {
// Mark the server as stoping.
s.setIsStopping()

View File

@ -160,7 +160,7 @@ func (s *Server) run() {
bc, err := handshake.VMSelectServer(c, compressionLevel)
if err != nil {
if s.isStopping() {
// c is closed inside Server.MustClose
// c is closed inside Server.MustStop
return
}
logger.Errorf("cannot perform vmselect handshake with client %q: %s", c.RemoteAddr(), err)
@ -187,8 +187,8 @@ func (s *Server) run() {
}
}
// MustClose gracefully closes s, so it no longer touches s.api after returning.
func (s *Server) MustClose() {
// MustStop gracefully stops s, so it no longer touches s.api after returning.
func (s *Server) MustStop() {
// Mark the server as stoping.
s.setIsStopping()