server: set registered only after configuring subscribers (#1557)

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-04-21 23:01:59 +03:00
parent 213359baed
commit 655bf08aca

10
grpc.go
View File

@ -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
} }