Apply suggestions from code review

Co-authored-by: Márk Sági-Kazár <sagikazarmark@users.noreply.github.com>
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
This commit is contained in:
Maksim Nabokikh 2021-02-05 13:15:09 +04:00 committed by m.nabokikh
parent 65a8bf2af3
commit 6664b5702d

View File

@ -83,9 +83,9 @@ func listenAndShutdownGracefully(logger log.Logger, gr *run.Group, srv *http.Ser
ctx, cancel := context.WithTimeout(context.Background(), time.Minute) ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel() defer cancel()
logger.Debugf("starting gracefully shutdown (%s)", name) logger.Debugf("starting graceful shutdown (%s)", name)
if err := srv.Shutdown(ctx); err != nil { if err := srv.Shutdown(ctx); err != nil {
logger.Errorf("gracefully shutdown (%s): %v", name, err) logger.Errorf("graceful shutdown (%s): %v", name, err)
} }
}) })
return nil return nil
@ -380,7 +380,7 @@ func runServe(options serveOptions) error {
logger.Infof("listening (grpc) on %s", c.GRPC.Addr) logger.Infof("listening (grpc) on %s", c.GRPC.Addr)
return grpcSrv.Serve(grpcListener) return grpcSrv.Serve(grpcListener)
}, func(err error) { }, func(err error) {
logger.Debugf("starting gracefully shutdown (grpc)") logger.Debugf("starting graceful shutdown (grpc)")
grpcSrv.GracefulStop() grpcSrv.GracefulStop()
}) })
} }