diff --git a/web/service.go b/web/service.go index c9efc25a..aed52eda 100644 --- a/web/service.go +++ b/web/service.go @@ -112,8 +112,8 @@ func (s *service) run(exit chan bool) { } func (s *service) register() error { - s.RLock() - defer s.RUnlock() + s.Lock() + defer s.Unlock() if s.srv == nil { return nil @@ -142,8 +142,8 @@ func (s *service) register() error { } func (s *service) deregister() error { - s.RLock() - defer s.RUnlock() + s.Lock() + defer s.Unlock() if s.srv == nil { return nil @@ -406,7 +406,9 @@ func (s *service) Init(opts ...Option) error { s.RLock() // pass in own name and version - serviceOpts = append(serviceOpts, micro.Name(s.opts.Name)) + if s.opts.Service.Name() == "" { + serviceOpts = append(serviceOpts, micro.Name(s.opts.Name)) + } serviceOpts = append(serviceOpts, micro.Version(s.opts.Version)) s.RUnlock()