only connect broker if there are subscribers
This commit is contained in:
parent
9a8c1b7ab8
commit
0c03bf064b
@ -752,6 +752,8 @@ func (g *grpcServer) Start() error {
|
|||||||
g.opts.Address = ts.Addr().String()
|
g.opts.Address = ts.Addr().String()
|
||||||
g.Unlock()
|
g.Unlock()
|
||||||
|
|
||||||
|
// only connect if we're subscribed
|
||||||
|
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
|
||||||
@ -761,6 +763,7 @@ func (g *grpcServer) Start() error {
|
|||||||
bname := config.Broker.String()
|
bname := config.Broker.String()
|
||||||
|
|
||||||
log.Logf("Broker [%s] Connected to %s", bname, baddr)
|
log.Logf("Broker [%s] Connected to %s", bname, baddr)
|
||||||
|
}
|
||||||
|
|
||||||
// announce self to the world
|
// announce self to the world
|
||||||
if err := g.Register(); err != nil {
|
if err := g.Register(); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user