This reverts commit 62a644ddd8
.
This commit is contained in:
parent
078dd4eb9b
commit
fbde872e7f
@ -659,13 +659,11 @@ func (g *grpcServer) Register() error {
|
|||||||
registered := g.registered
|
registered := g.registered
|
||||||
g.Unlock()
|
g.Unlock()
|
||||||
|
|
||||||
if registered {
|
if !registered {
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
|
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
|
||||||
logger.Infof("Registry [%s] Registering node: %s", config.Registry.String(), node.Id)
|
logger.Infof("Registry [%s] Registering node: %s", config.Registry.String(), node.Id)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// create registry options
|
// create registry options
|
||||||
rOpts := []registry.RegisterOption{registry.RegisterTTL(config.RegisterTTL)}
|
rOpts := []registry.RegisterOption{registry.RegisterTTL(config.RegisterTTL)}
|
||||||
@ -674,6 +672,11 @@ func (g *grpcServer) Register() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// already registered? don't need to register subscribers
|
||||||
|
if registered {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
g.Lock()
|
g.Lock()
|
||||||
defer g.Unlock()
|
defer g.Unlock()
|
||||||
|
|
||||||
@ -784,10 +787,10 @@ func (g *grpcServer) Start() error {
|
|||||||
g.RUnlock()
|
g.RUnlock()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
config := g.Options()
|
|
||||||
|
|
||||||
g.RUnlock()
|
g.RUnlock()
|
||||||
|
|
||||||
|
config := g.Options()
|
||||||
|
|
||||||
// micro: config.Transport.Listen(config.Address)
|
// micro: config.Transport.Listen(config.Address)
|
||||||
var ts net.Listener
|
var ts net.Listener
|
||||||
|
|
||||||
@ -819,11 +822,10 @@ func (g *grpcServer) Start() error {
|
|||||||
}
|
}
|
||||||
g.Lock()
|
g.Lock()
|
||||||
g.opts.Address = ts.Addr().String()
|
g.opts.Address = ts.Addr().String()
|
||||||
subscribes := g.subscribers
|
|
||||||
g.Unlock()
|
g.Unlock()
|
||||||
|
|
||||||
// only connect if we're subscribed
|
// only connect if we're subscribed
|
||||||
if len(subscribes) > 0 {
|
if len(g.subscribers) > 0 {
|
||||||
// connect to the broker
|
// connect to the broker
|
||||||
if err := config.Broker.Connect(); err != nil {
|
if err := config.Broker.Connect(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user