Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ChainGrpcPro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanjinfei
ChainGrpcPro
Commits
5e0c5a6b
Commit
5e0c5a6b
authored
Mar 08, 2023
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix fucn
parent
9234b25c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
go.sum
go.sum
+2
-0
bathTest.go
transaction/bathTest.go
+15
-9
No files found.
go.sum
View file @
5e0c5a6b
...
@@ -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=
...
...
transaction/bathTest.go
View file @
5e0c5a6b
...
@@ -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
:=
<-
batch
Sign
Request
:
case
batchRecover
:=
<-
batch
Recover
Request
:
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
.
Batch
Sign
(
context
.
Background
(),
batchRecover
,
grpc
.
CallContentSubtype
(
""
))
sign
,
err
:=
client
.
Batch
Recover
(
context
.
Background
(),
batchRecover
,
grpc
.
CallContentSubtype
(
""
))
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Errorf
(
"SendTranErr: %s"
,
err
)
log
.
Errorf
(
"SendTranErr: %s"
,
err
)
sign
,
err
=
client
.
Batch
Sign
(
context
.
Background
(),
batchRecover
,
grpc
.
CallContentSubtype
(
""
))
sign
,
err
=
client
.
Batch
Recover
(
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
:=
<-
batch
Sign
Request
:
case
batchVerify
:=
<-
batch
Verify
Request
:
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
.
Batch
Sign
(
context
.
Background
(),
batchVerify
,
grpc
.
CallContentSubtype
(
""
))
sign
,
err
:=
client
.
Batch
Verify
(
context
.
Background
(),
batchVerify
,
grpc
.
CallContentSubtype
(
""
))
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Errorf
(
"SendTranErr: %s"
,
err
)
log
.
Errorf
(
"SendTranErr: %s"
,
err
)
sign
,
err
=
client
.
Batch
Sign
(
context
.
Background
(),
batchVerify
,
grpc
.
CallContentSubtype
(
""
))
sign
,
err
=
client
.
Batch
Verify
(
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
:=
<-
batch
Sign
Request
:
case
batchRecoverTx
:=
<-
batch
RecoverTx
Request
:
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
.
Batch
Sign
(
context
.
Background
(),
batchRecoverTx
,
grpc
.
CallContentSubtype
(
""
))
sign
,
err
:=
client
.
Batch
RecoverTx
(
context
.
Background
(),
batchRecoverTx
,
grpc
.
CallContentSubtype
(
""
))
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Errorf
(
"SendTranErr: %s"
,
err
)
log
.
Errorf
(
"SendTranErr: %s"
,
err
)
sign
,
err
=
client
.
Batch
Sign
(
context
.
Background
(),
batchRecoverTx
,
grpc
.
CallContentSubtype
(
""
))
sign
,
err
=
client
.
Batch
RecoverTx
(
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment