Only log registering if not registered
This commit is contained in:
parent
adc24dfc51
commit
1adcb237d9
@ -230,7 +230,14 @@ func (s *rpcServer) Register() error {
|
|||||||
Endpoints: endpoints,
|
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
|
// create registry options
|
||||||
rOpts := []registry.RegisterOption{registry.RegisterTTL(config.RegisterTTL)}
|
rOpts := []registry.RegisterOption{registry.RegisterTTL(config.RegisterTTL)}
|
||||||
|
|
||||||
@ -238,13 +245,14 @@ func (s *rpcServer) Register() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
s.Lock()
|
// already registered? don't need to register subscribers
|
||||||
defer s.Unlock()
|
if registered {
|
||||||
|
|
||||||
if s.registered {
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.Lock()
|
||||||
|
defer s.Unlock()
|
||||||
|
|
||||||
s.registered = true
|
s.registered = true
|
||||||
|
|
||||||
for sb, _ := range s.subscribers {
|
for sb, _ := range s.subscribers {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user