fix waitgroup bug which crashes subscriber

This commit is contained in:
Asim Aslam 2019-05-29 09:28:04 +01:00
parent 58a70562d8
commit 9f037eafd2

View File

@ -244,9 +244,15 @@ func (s *rpcServer) createSubHandler(sb *subscriber, opts Options) broker.Handle
fn = opts.SubWrappers[i-1](fn)
}
s.wg.Add(1)
if s.wg != nil {
s.wg.Add(1)
}
go func() {
defer s.wg.Done()
if s.wg != nil {
defer s.wg.Done()
}
results <- fn(ctx, &rpcMessage{
topic: sb.topic,
contentType: ct,