Commit f8a0dbe3 authored by duanjinfei's avatar duanjinfei

add time sleep

parent 7e5d868c
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"ChainGrpcTest/tool" "ChainGrpcTest/tool"
"ChainGrpcTest/transaction" "ChainGrpcTest/transaction"
"sync" "sync"
"time"
) )
var ( var (
...@@ -38,20 +39,20 @@ func startTest() { ...@@ -38,20 +39,20 @@ func startTest() {
if err := transaction.InitBroadcastTxGoroutine(cfg); err != nil { if err := transaction.InitBroadcastTxGoroutine(cfg); err != nil {
log.Errorf("Init broadcast tx goroutine error: %s", err) log.Errorf("Init broadcast tx goroutine error: %s", err)
} }
for i := 0; i < cfg.GoRoutineCount; i++ { //for i := 0; i < cfg.GoRoutineCount; i++ {
go func() { go func() {
for { for {
select { select {
case arr := <-tranArrChan: case arr := <-tranArrChan:
log.Info("tranArrChan len:", len(tranArrChan)) log.Info("tranArrChan len:", len(tranArrChan))
log.Info("-----into tranArrChan-----") log.Info("-----into tranArrChan-----")
if err := transaction.BroadcastTxArr(arr, cfg); err != nil { if err := transaction.BroadcastTxArr(arr, cfg); err != nil {
log.Errorf("Bath Send Tran error: %s", err) log.Errorf("Bath Send Tran error: %s", err)
}
} }
} }
}() }
} }()
//}
for { for {
log.Info("----------------------------------start") log.Info("----------------------------------start")
//arr := transaction.SignedTxArr(syncMap, SendTxAccountArr, cfg) //arr := transaction.SignedTxArr(syncMap, SendTxAccountArr, cfg)
...@@ -59,6 +60,7 @@ func startTest() { ...@@ -59,6 +60,7 @@ func startTest() {
log.Info("----------------------------------end") log.Info("----------------------------------end")
tranArrChan <- arr tranArrChan <- arr
syncMap = updateNonce(syncMap, cfg) syncMap = updateNonce(syncMap, cfg)
time.Sleep(time.Second * 10)
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment