mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-13 00:11:28 +08:00
fix: grpc reconnect backoff
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/backoff"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
"google.golang.org/grpc/credentials/oauth"
|
"google.golang.org/grpc/credentials/oauth"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
@@ -169,6 +170,14 @@ func (c *grpcClient) start() (err error) {
|
|||||||
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(32 * 10e9)),
|
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(32 * 10e9)),
|
||||||
grpc.WithUnaryInterceptor(unaryInterceptor),
|
grpc.WithUnaryInterceptor(unaryInterceptor),
|
||||||
grpc.WithStreamInterceptor(streamInterceptor),
|
grpc.WithStreamInterceptor(streamInterceptor),
|
||||||
|
grpc.WithConnectParams(grpc.ConnectParams{
|
||||||
|
Backoff: backoff.Config{
|
||||||
|
BaseDelay: 1 * time.Second,
|
||||||
|
Multiplier: 1.2,
|
||||||
|
MaxDelay: 3 * time.Second,
|
||||||
|
},
|
||||||
|
MinConnectTimeout: 3 * time.Second,
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
c.config.conn, err = grpc.Dial(addr, opts...)
|
c.config.conn, err = grpc.Dial(addr, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1320,7 +1320,7 @@ func (r *masterRunner) reportStats() {
|
|||||||
table := tablewriter.NewWriter(os.Stdout)
|
table := tablewriter.NewWriter(os.Stdout)
|
||||||
table.SetColMinWidth(0, 20)
|
table.SetColMinWidth(0, 20)
|
||||||
table.SetColMinWidth(1, 10)
|
table.SetColMinWidth(1, 10)
|
||||||
table.SetHeader([]string{"Worker ID", "IP", "State", "Current Users", "CPU (%)", "Memory (%)"})
|
table.SetHeader([]string{"Worker ID", "IP", "State", "Current Users", "CPU Usage (%)", "Memory Usage (%)"})
|
||||||
|
|
||||||
for _, worker := range r.server.getAllWorkers() {
|
for _, worker := range r.server.getAllWorkers() {
|
||||||
row := make([]string, 6)
|
row := make([]string, 6)
|
||||||
|
|||||||
Reference in New Issue
Block a user