Commit 42b5f8e6 authored by duanjinfei's avatar duanjinfei

fix func

parent 5e0c5a6b
...@@ -21,7 +21,7 @@ func init() { ...@@ -21,7 +21,7 @@ func init() {
initCmd.PersistentFlags().BoolVar(&initCmp, "initCmp", false, "Start after initializing the account cmp balance") initCmd.PersistentFlags().BoolVar(&initCmp, "initCmp", false, "Start after initializing the account cmp balance")
startCmd.PersistentFlags().StringVar(&cpuProfile, "cpuProfile", "cpuProfile.prof", "Statistics cpu profile") startCmd.PersistentFlags().StringVar(&cpuProfile, "cpuProfile", "cpuProfile.prof", "Statistics cpu profile")
startCmd.PersistentFlags().BoolVar(&batchSign, "batchSign", false, "test grpc interface -> batchSign") startCmd.PersistentFlags().BoolVar(&batchSign, "batchSign", false, "test grpc interface -> batchSign")
startCmd.PersistentFlags().BoolVar(&batchRecover, "batchRecover", false, "test grpc interface -> batchRecover") startCmd.PersistentFlags().BoolVar(&batchRecover, "batchRecover", true, "test grpc interface -> batchRecover")
startCmd.PersistentFlags().BoolVar(&batchRecoverTx, "batchRecoverTx", false, "test grpc interface -> batchRecoverTx") startCmd.PersistentFlags().BoolVar(&batchRecoverTx, "batchRecoverTx", false, "test grpc interface -> batchRecoverTx")
startCmd.PersistentFlags().BoolVar(&batchVerify, "batchVerify", false, "test grpc interface -> batchVerify") startCmd.PersistentFlags().BoolVar(&batchVerify, "batchVerify", false, "test grpc interface -> batchVerify")
startCmd.PersistentFlags().IntVar(&txCount, "txCount", 1000, "send tran count") startCmd.PersistentFlags().IntVar(&txCount, "txCount", 1000, "send tran count")
......
...@@ -123,13 +123,14 @@ func BatchRecoverHandler(tranArr []*types.Transaction, cfg *tool.Config) error { ...@@ -123,13 +123,14 @@ func BatchRecoverHandler(tranArr []*types.Transaction, cfg *tool.Config) error {
log.Error("dial nebula failed", "err", err) log.Error("dial nebula failed", "err", err)
} }
serviceClient := crypterv1.NewCrypterServiceClient(grpcClient) serviceClient := crypterv1.NewCrypterServiceClient(grpcClient)
go batchRecover(serviceClient, cfg.SleepTime) for i := 0; i < cfg.GoRoutineCount; i++ {
go batchRecover(serviceClient, cfg.SleepTime)
}
allSignedTxCount = int64(len(tranArr)) allSignedTxCount = int64(len(tranArr))
startTime := time.Now() startTime := time.Now()
for i := 0; i < int(allSignedTxCount); i++ { for i := 0; i < int(allSignedTxCount); i++ {
req := crypterv1.BatchSignRequest{} req := crypterv1.BatchRecoverRequest{}
batchSignRequest <- &req batchRecoverRequest <- &req
} }
for { for {
if bathHandleSendCount == allSignedTxCount { if bathHandleSendCount == allSignedTxCount {
...@@ -178,12 +179,14 @@ func BatchVerifyHandler(tranArr []*types.Transaction, cfg *tool.Config) error { ...@@ -178,12 +179,14 @@ func BatchVerifyHandler(tranArr []*types.Transaction, cfg *tool.Config) error {
if err != nil { if err != nil {
log.Error("dial nebula failed", "err", err) log.Error("dial nebula failed", "err", err)
} }
go batchVerify(crypterv1.NewCrypterServiceClient(client), cfg.SleepTime) for i := 0; i < cfg.GoRoutineCount; i++ {
go batchVerify(crypterv1.NewCrypterServiceClient(client), cfg.SleepTime)
}
allSignedTxCount = int64(len(tranArr)) allSignedTxCount = int64(len(tranArr))
startTime := time.Now() startTime := time.Now()
for i := 0; i < int(allSignedTxCount); i++ { for i := 0; i < int(allSignedTxCount); i++ {
req := crypterv1.BatchSignRequest{} req := crypterv1.BatchVerifyRequest{}
batchSignRequest <- &req batchVerifyRequest <- &req
} }
for { for {
...@@ -233,13 +236,14 @@ func BatchRecoverTxHandler(tranArr []*types.Transaction, cfg *tool.Config) error ...@@ -233,13 +236,14 @@ func BatchRecoverTxHandler(tranArr []*types.Transaction, cfg *tool.Config) error
if err != nil { if err != nil {
log.Error("dial nebula failed", "err", err) log.Error("dial nebula failed", "err", err)
} }
go batchRecoverTx(crypterv1.NewCrypterServiceClient(client), cfg.SleepTime) for i := 0; i < cfg.GoRoutineCount; i++ {
go batchRecoverTx(crypterv1.NewCrypterServiceClient(client), cfg.SleepTime)
}
allSignedTxCount = int64(len(tranArr)) allSignedTxCount = int64(len(tranArr))
startTime := time.Now() startTime := time.Now()
for i := 0; i < int(allSignedTxCount); i++ { for i := 0; i < int(allSignedTxCount); i++ {
req := crypterv1.BatchSignRequest{} req := crypterv1.BatchRecoverTxRequest{}
batchSignRequest <- &req batchRecoverTxRequest <- &req
} }
for { for {
if bathHandleSendCount == allSignedTxCount { if bathHandleSendCount == allSignedTxCount {
......
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