Merge pull request #14422 from kkkkun/remove-redundant-code

remove redundant log messsages
dependabot/go_modules/go.uber.org/atomic-1.10.0
Benjamin Wang 2022-09-16 12:18:43 +08:00 committed by GitHub
commit b7ba0542f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -23,6 +23,8 @@ import (
"sync"
"syscall"
"go.etcd.io/etcd/client/pkg/v3/verify"
"go.uber.org/zap"
)
@ -47,6 +49,7 @@ func RegisterInterruptHandler(h InterruptHandler) {
// HandleInterrupts calls the handler functions on receiving a SIGINT or SIGTERM.
func HandleInterrupts(lg *zap.Logger) {
verify.Assert(lg != nil, "the logger should not be nil")
notifier := make(chan os.Signal, 1)
signal.Notify(notifier, syscall.SIGINT, syscall.SIGTERM)
@ -60,9 +63,7 @@ func HandleInterrupts(lg *zap.Logger) {
interruptExitMu.Lock()
if lg != nil {
lg.Info("received signal; shutting down", zap.String("signal", sig.String()))
}
lg.Info("received signal; shutting down", zap.String("signal", sig.String()))
for _, h := range ihs {
h()

View File

@ -120,10 +120,12 @@ func startEtcdOrProxyV2(args []string) {
)
}
} else {
lg.Info(
"Initialize and start etcd server",
zap.String("data-dir", cfg.ec.Dir),
zap.String("dir-type", string(which)),
)
stopped, errc, err = startEtcd(&cfg.ec)
if err != nil {
lg.Warn("failed to start etcd", zap.Error(err))
}
}
if err != nil {