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

@ -189,17 +189,15 @@ func invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli
FailFast: c.failFast,
}
sh.HandleRPC(ctx, begin)
}
defer func() {
if sh != nil {
defer func() {
end := &stats.End{
Client: true,
EndTime: time.Now(),
Error: e,
}
sh.HandleRPC(ctx, end)
}
}()
}()
}
topts := &transport.Options{
Last: true,
Delay: false,