Browse Source

only call Sleep if it took us less than 1 sec. to generate txs

pull/1943/head
Anton Kaliaev 7 years ago
parent
commit
80e6e0fa05
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

@ -168,7 +168,7 @@ func (t *transacter) sendLoop(connIndex int) {
Params: rawParamsJSON, Params: rawParamsJSON,
}) })
if err != nil { if err != nil {
fmt.Printf("%v. Try reducing the connections count and increasing the rate.\n", errors.Wrap(err, "txs send failed"))
fmt.Fprintf(os.Stderr, "%v. Try reducing the connections count and increasing the rate.\n", errors.Wrap(err, "txs send failed"))
os.Exit(1) os.Exit(1)
} }
@ -176,7 +176,9 @@ func (t *transacter) sendLoop(connIndex int) {
} }
timeToSend := time.Now().Sub(startTime) timeToSend := time.Now().Sub(startTime)
time.Sleep(time.Second - timeToSend)
if timeToSend < 1*time.Second {
time.Sleep(time.Second - timeToSend)
}
logger.Info(fmt.Sprintf("sent %d transactions", t.Rate), "took", timeToSend) logger.Info(fmt.Sprintf("sent %d transactions", t.Rate), "took", timeToSend)
case <-pingsTicker.C: case <-pingsTicker.C:
// go-rpc server closes the connection in the absence of pings // go-rpc server closes the connection in the absence of pings


Loading…
Cancel
Save