diff --git a/grpc.go b/grpc.go index 393f4f9..449455f 100644 --- a/grpc.go +++ b/grpc.go @@ -692,11 +692,6 @@ func (g *grpcServer) Register() error { g.Lock() defer g.Unlock() - if cacheService { - g.rsvc = service - } - g.registered = true - for sb := range g.subscribers { handler := g.createSubHandler(sb, g.opts) var opts []broker.SubscribeOption @@ -722,6 +717,11 @@ func (g *grpcServer) Register() error { g.subscribers[sb] = []broker.Subscriber{sub} } + g.registered = true + if cacheService { + g.rsvc = service + } + return nil }