Browse Source

[tm-bench] nice formatting for error

pull/1943/head
Anton Kaliaev 8 years ago
parent
commit
14b0589d6b
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      tm-bench/transacter.go

+ 4
- 2
tm-bench/transacter.go View File

@ -5,6 +5,7 @@ import (
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"math/rand" "math/rand"
"os"
"sync" "sync"
"time" "time"
@ -47,8 +48,8 @@ func (t *transacter) Start() error {
} }
} }
t.wg.Add(t.Connections)
for i := 0; i < t.Connections; i++ { for i := 0; i < t.Connections; i++ {
t.wg.Add(1)
go t.sendLoop(i) go t.sendLoop(i)
} }
@ -84,7 +85,8 @@ func (t *transacter) sendLoop(connIndex int) {
Params: []interface{}{hex.EncodeToString(tx)}, Params: []interface{}{hex.EncodeToString(tx)},
}) })
if err != nil { if err != nil {
panic(errors.Wrap(err, fmt.Sprintf("lost connection to %s", conn.Address)))
fmt.Printf("Lost connection to %s. Please restart the test.\nDetails:\n%v", conn.Address, err)
os.Exit(1)
} }
num++ num++
} }


Loading…
Cancel
Save