defer wg.Done so it's called even if there's a panic

This commit is contained in:
Asim Aslam
2017-06-12 14:18:59 +01:00
parent 32b7ebcfbc
commit 3812cbbcb6
2 changed files with 2 additions and 5 deletions

View File

@@ -228,12 +228,12 @@ func (s *rpcServer) createSubHandler(sb *subscriber, opts Options) broker.Handle
s.wg.Add(1)
go func() {
defer s.wg.Done()
fn(ctx, &rpcPublication{
topic: sb.topic,
contentType: ct,
message: req.Interface(),
})
s.wg.Done()
}()
}
return nil