From 78994035bcbebd375d98aa7733a487fc54ff90c6 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Wed, 4 May 2016 10:50:09 -0700 Subject: [PATCH] Modify comments --- benchmark/worker/benchmark_client.go | 5 ++--- benchmark/worker/benchmark_server.go | 2 +- benchmark/worker/main.go | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/benchmark/worker/benchmark_client.go b/benchmark/worker/benchmark_client.go index 462807f2..b73d7624 100644 --- a/benchmark/worker/benchmark_client.go +++ b/benchmark/worker/benchmark_client.go @@ -91,7 +91,8 @@ func setupClientEnv(config *testpb.ClientConfig) { } // createConns creates connections according to given config. -// It returns a slice of connections created, the function to close all connections, and errors if any. +// It returns the connections and corresponding function to close them. +// It returns non-nil error if there is anything wrong. func createConns(config *testpb.ClientConfig) ([]*grpc.ClientConn, func(), error) { var opts []grpc.DialOption @@ -222,7 +223,6 @@ func (bc *benchmarkClient) doCloseLoopUnary(conns []*grpc.ClientConn, rpcCountPe for _, conn := range conns { client := testpb.NewBenchmarkServiceClient(conn) // For each connection, create rpcCountPerConn goroutines to do rpc. - // Close this connection after all goroutines finish. for j := 0; j < rpcCountPerConn; j++ { go func() { // TODO: do warm up if necessary. @@ -269,7 +269,6 @@ func (bc *benchmarkClient) doCloseLoopStreaming(conns []*grpc.ClientConn, rpcCou } for _, conn := range conns { // For each connection, create rpcCountPerConn goroutines to do rpc. - // Close this connection after all goroutines finish. for j := 0; j < rpcCountPerConn; j++ { c := testpb.NewBenchmarkServiceClient(conn) stream, err := c.StreamingCall(context.Background()) diff --git a/benchmark/worker/benchmark_server.go b/benchmark/worker/benchmark_server.go index 6a2fab2b..94dc5b20 100644 --- a/benchmark/worker/benchmark_server.go +++ b/benchmark/worker/benchmark_server.go @@ -140,7 +140,7 @@ func startBenchmarkServer(config *testpb.ServerConfig, serverPort int) (*benchma return nil, grpc.Errorf(codes.InvalidArgument, "unknow payload config: %v", config.PayloadConfig) } } else { - // Start protobuf server is payload config is nil. + // Start protobuf server if payload config is nil. addr, closeFunc = benchmark.StartServer(benchmark.ServerInfo{ Addr: ":" + strconv.Itoa(port), Type: "protobuf", diff --git a/benchmark/worker/main.go b/benchmark/worker/main.go index c7bad9b0..236ca8df 100644 --- a/benchmark/worker/main.go +++ b/benchmark/worker/main.go @@ -229,6 +229,8 @@ func main() { go func() { <-stop + // Wait for 1 second before stopping the server to make sure the return value of QuitWorker is sent to client. + // TODO revise this once server graceful stop is supported in gRPC. time.Sleep(time.Second) s.Stop() }()