Browse Source

[tm-bench] exit on CTRL-C (#2405)

pull/2571/head
bradyjoestar 6 years ago
committed by Anton Kaliaev
parent
commit
4c0c6e0116
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      tools/tm-bench/main.go

+ 15
- 0
tools/tm-bench/main.go View File

@ -12,6 +12,8 @@ import (
"github.com/tendermint/tendermint/libs/log"
tmrpc "github.com/tendermint/tendermint/rpc/client"
"os/signal"
"syscall"
)
var logger = log.NewNopLogger()
@ -101,6 +103,19 @@ Examples:
"broadcast_tx_"+broadcastTxMethod,
)
//catch Interrupt and quit tm-bench
go func() {
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
for sig := range c {
fmt.Printf("captured %v, exiting...\n", sig)
for _, t := range transacters {
t.Stop()
}
os.Exit(1)
}
}()
// Wait until transacters have begun until we get the start time
timeStart := time.Now()
logger.Info("Time last transacter started", "t", timeStart)


Loading…
Cancel
Save