Fix error handling of json

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-06-27 01:39:41 +02:00
parent a2fd0aad41
commit 9cd34509ee
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -321,9 +321,6 @@ var importAnalyzeCmd = &cli.Command{
for { for {
b, ok := <-jsonIn b, ok := <-jsonIn
var tse TipSetExec
json.Unmarshal(b, &tse)
if !ok { if !ok {
results <- result{ results <- result{
totalTime: totalTime, totalTime: totalTime,
@ -333,6 +330,13 @@ var importAnalyzeCmd = &cli.Command{
return return
} }
var tse TipSetExec
err := json.Unmarshal(b, &tse)
if err != nil {
log.Warnf("error unmarshaling tipset: %+v", err)
continue
}
totalTime += tse.Duration totalTime += tse.Duration
for _, inv := range tse.Trace { for _, inv := range tse.Trace {
if inv.Duration > leastExpensiveInvoc { if inv.Duration > leastExpensiveInvoc {