shorten the waiting time on txgen

Signed-off-by: Leo Chen <leo@harmony.one>
pull/515/head
Leo Chen 6 years ago
parent 54f35caf77
commit a55cec221f
  1. 18
      cmd/client/txgen/main.go

@ -123,11 +123,7 @@ func main() {
clientNode.Client = client.NewClient(clientNode.GetHost(), shardIDLeaderMap)
readySignal := make(chan uint32)
go func() {
for i := range shardIDLeaderMap {
readySignal <- i
}
}()
// This func is used to update the client's blockchain when new blocks are received from the leaders
updateBlocksFunc := func(blocks []*types.Block) {
utils.GetLogInstance().Info("[Txgen] Received new block", "block", blocks)
@ -158,12 +154,18 @@ func main() {
// Start the client server to listen to leader's message
go clientNode.StartServer()
// wait for 1 seconds for client to send ping message to leader
time.Sleep(time.Second)
clientNode.State = node.NodeReadyForConsensus
go func() {
// wait for 3 seconds for client to send ping message to leader
// FIXME (leo) the readySignal should be set once we really sent ping message to leader
time.Sleep(3 * time.Second) // wait for nodes to be ready
for i := range shardIDLeaderMap {
readySignal <- i
}
}()
// Transaction generation process
time.Sleep(5 * time.Second) // wait for nodes to be ready
start := time.Now()
totalTime := float64(*duration)

Loading…
Cancel
Save