only connect broker if there are subscribers
This commit is contained in:
parent
ab6334fad1
commit
3a1515040f
19
grpc.go
19
grpc.go
@ -752,16 +752,19 @@ func (g *grpcServer) Start() error {
|
|||||||
g.opts.Address = ts.Addr().String()
|
g.opts.Address = ts.Addr().String()
|
||||||
g.Unlock()
|
g.Unlock()
|
||||||
|
|
||||||
// connect to the broker
|
// only connect if we're subscribed
|
||||||
if err := config.Broker.Connect(); err != nil {
|
if len(g.subscribers) > 0 {
|
||||||
return err
|
// connect to the broker
|
||||||
|
if err := config.Broker.Connect(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
baddr := config.Broker.Address()
|
||||||
|
bname := config.Broker.String()
|
||||||
|
|
||||||
|
log.Logf("Broker [%s] Connected to %s", bname, baddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
baddr := config.Broker.Address()
|
|
||||||
bname := config.Broker.String()
|
|
||||||
|
|
||||||
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 {
|
||||||
log.Log("Server register error: ", err)
|
log.Log("Server register error: ", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user