From ab27b1c23a8934438f33413a0775ad7a8b705d39 Mon Sep 17 00:00:00 2001 From: huangyi Date: Sun, 18 Jul 2021 01:01:51 +0800 Subject: [PATCH] fix race condition in test credit to @robert-zaremba --- testutil/network/util.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/testutil/network/util.go b/testutil/network/util.go index 74d8c68d29ca..e7542113a87b 100644 --- a/testutil/network/util.go +++ b/testutil/network/util.go @@ -106,21 +106,10 @@ func startInProcess(cfg Config, val *Validator) error { val.grpc = grpcSrv if val.AppConfig.GRPCWeb.Enable { - errCh1 := make(chan error) - go func() { - grpcWeb, err := servergrpc.StartGRPCWeb(grpcSrv, *val.AppConfig) - if err != nil { - errCh1 <- err - } - - val.grpcWeb = grpcWeb - }() - select { - case err := <-errCh1: + val.grpcWeb, err = servergrpc.StartGRPCWeb(grpcSrv, *val.AppConfig) + if err != nil { return err - case <-time.After(srvtypes.ServerStartTime): // assume server started successfully } - } }