From 655bf08aca8a20b97837749fa3d2b5d3f78afef2 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 21 Apr 2020 23:01:59 +0300 Subject: [PATCH] server: set registered only after configuring subscribers (#1557) Signed-off-by: Vasiliy Tolstov --- grpc.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 }