1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00

Only log registering if not registered

This commit is contained in:
Asim 2016-02-27 22:14:25 +00:00
parent adc24dfc51
commit 1adcb237d9

View File

@ -230,7 +230,14 @@ func (s *rpcServer) Register() error {
Endpoints: endpoints,
}
log.Infof("Registering node: %s", node.Id)
s.Lock()
registered := s.registered
s.Unlock()
if !registered {
log.Infof("Registering node: %s", node.Id)
}
// create registry options
rOpts := []registry.RegisterOption{registry.RegisterTTL(config.RegisterTTL)}
@ -238,13 +245,14 @@ func (s *rpcServer) Register() error {
return err
}
s.Lock()
defer s.Unlock()
if s.registered {
// already registered? don't need to register subscribers
if registered {
return nil
}
s.Lock()
defer s.Unlock()
s.registered = true
for sb, _ := range s.subscribers {