Commit c8fc9288 authored by duanjinfei's avatar duanjinfei

add handler send tx count log print

parent 41f76f4a
...@@ -17,8 +17,8 @@ import ( ...@@ -17,8 +17,8 @@ import (
) )
var ( var (
bathHandleSendCount, allSignedTxCount, totalSendTime int64 bathHandleSendCount, allSignedTxCount, totalSendTime, beforeBathHandleSendCount int64
broadcastEthTxWithFromRequestsArr chan *ring.BroadcastEthTxWithFromRequests broadcastEthTxWithFromRequestsArr chan *ring.BroadcastEthTxWithFromRequests
) )
func init() { func init() {
...@@ -62,6 +62,9 @@ func BroadcastTxArr(tranArr []*types.Transaction, cfg *tool.Config) error { ...@@ -62,6 +62,9 @@ func BroadcastTxArr(tranArr []*types.Transaction, cfg *tool.Config) error {
} }
} }
for { for {
time.Sleep(time.Second * 3)
log.Info("beforeBathHandleSendCount:", beforeBathHandleSendCount)
log.Infof("Send tran count: %d", bathHandleSendCount)
if bathHandleSendCount == allSignedTxCount { if bathHandleSendCount == allSignedTxCount {
log.Infof("Send tran count: %d", bathHandleSendCount) log.Infof("Send tran count: %d", bathHandleSendCount)
log.Infof("Since time: %d ms", time.Since(startTime).Milliseconds()) log.Infof("Since time: %d ms", time.Since(startTime).Milliseconds())
...@@ -80,6 +83,7 @@ func broadcastTx(cfg *tool.Config, client ring.RingServiceClient) error { ...@@ -80,6 +83,7 @@ func broadcastTx(cfg *tool.Config, client ring.RingServiceClient) error {
sendTranStartTime := time.Now() sendTranStartTime := time.Now()
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel() defer cancel()
atomic.AddInt64(&beforeBathHandleSendCount, int64(len(broadcastEthTxWithFromRequests.List)))
_, err := client.BroadcastTxs(ctx, broadcastEthTxWithFromRequests) _, err := client.BroadcastTxs(ctx, broadcastEthTxWithFromRequests)
if err != nil { if err != nil {
log.Error("BroadcastTxs Error:", err) log.Error("BroadcastTxs Error:", err)
......
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