[#745] node: Add more debug logs on shutdown

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-08-04 17:44:37 +03:00 committed by Alex Vanin
parent 3d981320c6
commit b5cadff2c3
4 changed files with 18 additions and 0 deletions

View file

@ -50,9 +50,17 @@ func serveGRPC(c *cfg) {
go func() {
defer func() {
c.log.Info("stop listening gRPC endpoint",
zap.String("endpoint", lis.Addr().String()),
)
c.wg.Done()
}()
c.log.Info("start listening gRPC endpoint",
zap.String("endpoint", lis.Addr().String()),
)
if err := srv.Serve(lis); err != nil {
fmt.Println("gRPC server error", err)
}

View file

@ -117,6 +117,8 @@ func shutdown(c *cfg) {
closer()
}
c.log.Debug("waiting for all processes to stop")
c.wg.Wait()
}

View file

@ -31,11 +31,15 @@ func initMetrics(c *cfg) {
}))
c.closers = append(c.closers, func() {
c.log.Debug("shutting down metrics service")
err := srv.Shutdown()
if err != nil {
c.log.Debug("could not shutdown metrics server",
zap.String("error", err.Error()),
)
}
c.log.Debug("metrics service has been stopped")
})
}

View file

@ -30,11 +30,15 @@ func initProfiler(c *cfg) {
}))
c.closers = append(c.closers, func() {
c.log.Debug("shutting down profiling service")
err := srv.Shutdown()
if err != nil {
c.log.Debug("could not shutdown pprof server",
zap.String("error", err.Error()),
)
}
c.log.Debug("profiling service has been stopped")
})
}