Fix invalid register check err in log (#1801)

* remove global error tracking

* rpc_server: fix invalid register err

Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
Di Wu 2020-07-07 21:14:23 +08:00 committed by GitHub
parent 0ed1c70d29
commit b37f9c94b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -898,7 +898,7 @@ func (s *rpcServer) Start() error {
rerr := s.opts.RegisterCheck(s.opts.Context) rerr := s.opts.RegisterCheck(s.opts.Context)
if rerr != nil && registered { if rerr != nil && registered {
if logger.V(logger.ErrorLevel, logger.DefaultLogger) { if logger.V(logger.ErrorLevel, logger.DefaultLogger) {
log.Errorf("Server %s-%s register check error: %s, deregister it", config.Name, config.Id, err) log.Errorf("Server %s-%s register check error: %s, deregister it", config.Name, config.Id, rerr)
} }
// deregister self in case of error // deregister self in case of error
if err := s.Deregister(); err != nil { if err := s.Deregister(); err != nil {
@ -908,7 +908,7 @@ func (s *rpcServer) Start() error {
} }
} else if rerr != nil && !registered { } else if rerr != nil && !registered {
if logger.V(logger.ErrorLevel, logger.DefaultLogger) { if logger.V(logger.ErrorLevel, logger.DefaultLogger) {
log.Errorf("Server %s-%s register check error: %s", config.Name, config.Id, err) log.Errorf("Server %s-%s register check error: %s", config.Name, config.Id, rerr)
} }
continue continue
} }