server: set registered only after configuring subscribers (#1557)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
d7ecb58f6c
commit
bea092f082
@ -692,11 +692,6 @@ func (g *grpcServer) Register() error {
|
|||||||
g.Lock()
|
g.Lock()
|
||||||
defer g.Unlock()
|
defer g.Unlock()
|
||||||
|
|
||||||
if cacheService {
|
|
||||||
g.rsvc = service
|
|
||||||
}
|
|
||||||
g.registered = true
|
|
||||||
|
|
||||||
for sb := range g.subscribers {
|
for sb := range g.subscribers {
|
||||||
handler := g.createSubHandler(sb, g.opts)
|
handler := g.createSubHandler(sb, g.opts)
|
||||||
var opts []broker.SubscribeOption
|
var opts []broker.SubscribeOption
|
||||||
@ -722,6 +717,11 @@ func (g *grpcServer) Register() error {
|
|||||||
g.subscribers[sb] = []broker.Subscriber{sub}
|
g.subscribers[sb] = []broker.Subscriber{sub}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g.registered = true
|
||||||
|
if cacheService {
|
||||||
|
g.rsvc = service
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,10 +650,6 @@ func (s *rpcServer) Register() error {
|
|||||||
s.Lock()
|
s.Lock()
|
||||||
defer s.Unlock()
|
defer s.Unlock()
|
||||||
|
|
||||||
if cacheService {
|
|
||||||
s.rsvc = service
|
|
||||||
}
|
|
||||||
s.registered = true
|
|
||||||
// set what we're advertising
|
// set what we're advertising
|
||||||
s.opts.Advertise = addr
|
s.opts.Advertise = addr
|
||||||
|
|
||||||
@ -693,6 +689,10 @@ func (s *rpcServer) Register() error {
|
|||||||
}
|
}
|
||||||
s.subscribers[sb] = []broker.Subscriber{sub}
|
s.subscribers[sb] = []broker.Subscriber{sub}
|
||||||
}
|
}
|
||||||
|
if cacheService {
|
||||||
|
s.rsvc = service
|
||||||
|
}
|
||||||
|
s.registered = true
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user