don't add defer func if stats handler is nil (#1214)

This commit is contained in:
kirk
2017-05-02 12:16:45 -05:00
committed by Menghan Li
parent 0eb507a2ca
commit 0914b46180
3 changed files with 19 additions and 25 deletions

View File

@ -161,17 +161,17 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth
FailFast: c.failFast,
}
sh.HandleRPC(ctx, begin)
}
defer func() {
if err != nil && sh != nil {
// Only handle end stats if err != nil.
end := &stats.End{
Client: true,
Error: err,
defer func() {
if err != nil {
// Only handle end stats if err != nil.
end := &stats.End{
Client: true,
Error: err,
}
sh.HandleRPC(ctx, end)
}
sh.HandleRPC(ctx, end)
}
}()
}()
}
gopts := BalancerGetOptions{
BlockingWait: !c.failFast,
}