Reuse query client in scale tests (#1091)

It was previously not reusing it, so the clients would leak over time.
This commit is contained in:
Scott Redig
2020-02-03 13:12:02 -08:00
committed by GitHub
parent d3e008cd1e
commit d67a65e648

View File

@ -104,8 +104,15 @@ func getQueryServiceGRPCClient() pb.QueryServiceClient {
}
func queryPoolsWrapper(mmf func(req *pb.MatchProfile, pools map[string][]*pb.Ticket) ([]*pb.Match, error)) matchFunction {
var q pb.QueryServiceClient
var startQ sync.Once
return func(req *pb.RunRequest, stream pb.MatchFunction_RunServer) error {
poolTickets, err := matchfunction.QueryPools(stream.Context(), getQueryServiceGRPCClient(), req.GetProfile().GetPools())
startQ.Do(func() {
q = getQueryServiceGRPCClient()
})
poolTickets, err := matchfunction.QueryPools(stream.Context(), q, req.GetProfile().GetPools())
if err != nil {
return err
}