Commit 5e0c5a6b authored by duanjinfei's avatar duanjinfei

fix fucn

parent 9234b25c
...@@ -14,6 +14,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t ...@@ -14,6 +14,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI=
github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/deckarep/golang-set/v2 v2.2.0 h1:2pMQd3Soi6qfw7E5MMKaEh5W5ES18bW3AbFFnGl6LgQ= github.com/deckarep/golang-set/v2 v2.2.0 h1:2pMQd3Soi6qfw7E5MMKaEh5W5ES18bW3AbFFnGl6LgQ=
github.com/deckarep/golang-set/v2 v2.2.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/deckarep/golang-set/v2 v2.2.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
......
...@@ -14,12 +14,18 @@ import ( ...@@ -14,12 +14,18 @@ import (
var ( var (
batchSignRequest chan *crypterv1.BatchSignRequest batchSignRequest chan *crypterv1.BatchSignRequest
batchRecoverRequest chan *crypterv1.BatchRecoverRequest
batchRecoverTxRequest chan *crypterv1.BatchRecoverTxRequest
batchVerifyRequest chan *crypterv1.BatchVerifyRequest
clientMap map[int]crypterv1.CrypterServiceClient clientMap map[int]crypterv1.CrypterServiceClient
bathHandleSendCount, allSignedTxCount, totalSendTime int64 bathHandleSendCount, allSignedTxCount, totalSendTime int64
) )
func init() { func init() {
batchSignRequest = make(chan *crypterv1.BatchSignRequest, 1000000) batchSignRequest = make(chan *crypterv1.BatchSignRequest, 1000000)
batchRecoverRequest = make(chan *crypterv1.BatchRecoverRequest, 1000000)
batchRecoverTxRequest = make(chan *crypterv1.BatchRecoverTxRequest, 1000000)
batchVerifyRequest = make(chan *crypterv1.BatchVerifyRequest, 1000000)
clientMap = make(map[int]crypterv1.CrypterServiceClient) clientMap = make(map[int]crypterv1.CrypterServiceClient)
} }
...@@ -84,7 +90,7 @@ func batchRecover(client crypterv1.CrypterServiceClient, sleepTime int) { ...@@ -84,7 +90,7 @@ func batchRecover(client crypterv1.CrypterServiceClient, sleepTime int) {
var beforeSendTxTime time.Time var beforeSendTxTime time.Time
for { for {
select { select {
case batchRecover := <-batchSignRequest: case batchRecover := <-batchRecoverRequest:
if sleepTime != 0 { if sleepTime != 0 {
time.Sleep(time.Millisecond * time.Duration(sleepTime)) time.Sleep(time.Millisecond * time.Duration(sleepTime))
} }
...@@ -92,10 +98,10 @@ func batchRecover(client crypterv1.CrypterServiceClient, sleepTime int) { ...@@ -92,10 +98,10 @@ func batchRecover(client crypterv1.CrypterServiceClient, sleepTime int) {
if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 { if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 {
time.Sleep(time.Millisecond * time.Duration(1)) time.Sleep(time.Millisecond * time.Duration(1))
} }
sign, err := client.BatchSign(context.Background(), batchRecover, grpc.CallContentSubtype("")) sign, err := client.BatchRecover(context.Background(), batchRecover, grpc.CallContentSubtype(""))
if err != nil { if err != nil {
log.Errorf("SendTranErr: %s", err) log.Errorf("SendTranErr: %s", err)
sign, err = client.BatchSign(context.Background(), batchRecover, grpc.CallContentSubtype("")) sign, err = client.BatchRecover(context.Background(), batchRecover, grpc.CallContentSubtype(""))
if err != nil { if err != nil {
log.Errorf("Send tran twice err: %s", err) log.Errorf("Send tran twice err: %s", err)
continue continue
...@@ -140,7 +146,7 @@ func batchVerify(client crypterv1.CrypterServiceClient, sleepTime int) { ...@@ -140,7 +146,7 @@ func batchVerify(client crypterv1.CrypterServiceClient, sleepTime int) {
var beforeSendTxTime time.Time var beforeSendTxTime time.Time
for { for {
select { select {
case batchVerify := <-batchSignRequest: case batchVerify := <-batchVerifyRequest:
if sleepTime != 0 { if sleepTime != 0 {
time.Sleep(time.Millisecond * time.Duration(sleepTime)) time.Sleep(time.Millisecond * time.Duration(sleepTime))
} }
...@@ -148,10 +154,10 @@ func batchVerify(client crypterv1.CrypterServiceClient, sleepTime int) { ...@@ -148,10 +154,10 @@ func batchVerify(client crypterv1.CrypterServiceClient, sleepTime int) {
if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 { if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 {
time.Sleep(time.Millisecond * time.Duration(1)) time.Sleep(time.Millisecond * time.Duration(1))
} }
sign, err := client.BatchSign(context.Background(), batchVerify, grpc.CallContentSubtype("")) sign, err := client.BatchVerify(context.Background(), batchVerify, grpc.CallContentSubtype(""))
if err != nil { if err != nil {
log.Errorf("SendTranErr: %s", err) log.Errorf("SendTranErr: %s", err)
sign, err = client.BatchSign(context.Background(), batchVerify, grpc.CallContentSubtype("")) sign, err = client.BatchVerify(context.Background(), batchVerify, grpc.CallContentSubtype(""))
if err != nil { if err != nil {
log.Errorf("Send tran twice err: %s", err) log.Errorf("Send tran twice err: %s", err)
continue continue
...@@ -195,7 +201,7 @@ func batchRecoverTx(client crypterv1.CrypterServiceClient, sleepTime int) { ...@@ -195,7 +201,7 @@ func batchRecoverTx(client crypterv1.CrypterServiceClient, sleepTime int) {
var beforeSendTxTime time.Time var beforeSendTxTime time.Time
for { for {
select { select {
case batchRecoverTx := <-batchSignRequest: case batchRecoverTx := <-batchRecoverTxRequest:
if sleepTime != 0 { if sleepTime != 0 {
time.Sleep(time.Millisecond * time.Duration(sleepTime)) time.Sleep(time.Millisecond * time.Duration(sleepTime))
} }
...@@ -203,10 +209,10 @@ func batchRecoverTx(client crypterv1.CrypterServiceClient, sleepTime int) { ...@@ -203,10 +209,10 @@ func batchRecoverTx(client crypterv1.CrypterServiceClient, sleepTime int) {
if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 { if beforeSendTxTime.UnixMilli() > 0 && time.Since(beforeSendTxTime).Milliseconds() < 1 {
time.Sleep(time.Millisecond * time.Duration(1)) time.Sleep(time.Millisecond * time.Duration(1))
} }
sign, err := client.BatchSign(context.Background(), batchRecoverTx, grpc.CallContentSubtype("")) sign, err := client.BatchRecoverTx(context.Background(), batchRecoverTx, grpc.CallContentSubtype(""))
if err != nil { if err != nil {
log.Errorf("SendTranErr: %s", err) log.Errorf("SendTranErr: %s", err)
sign, err = client.BatchSign(context.Background(), batchRecoverTx, grpc.CallContentSubtype("")) sign, err = client.BatchRecoverTx(context.Background(), batchRecoverTx, grpc.CallContentSubtype(""))
if err != nil { if err != nil {
log.Errorf("Send tran twice err: %s", err) log.Errorf("Send tran twice err: %s", err)
continue continue
......
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