(req *runtimev1.QueryBatchRequest, srv runtimev1.QueryService_QueryBatchServer)
| 8 | ) |
| 9 | |
| 10 | func (s *Server) QueryBatch(req *runtimev1.QueryBatchRequest, srv runtimev1.QueryService_QueryBatchServer) error { |
| 11 | // TODO: Performance improvements: |
| 12 | // 1. Check for access upfront based on what is in the request |
| 13 | // 2. Check for cache and return those queries immediately before creating a goroutine |
| 14 | // 3. Use a goroutine pool with size equal to driver's concurrency to execute the queries |
| 15 | |
| 16 | g, ctx := errgroup.WithContext(srv.Context()) |
| 17 | |
| 18 | for idx, qry := range req.Queries { |
| 19 | idx := idx |
| 20 | qry := qry |
| 21 | g.Go(func() error { |
| 22 | resp := s.forwardQuery(ctx, req.InstanceId, idx, qry) |
| 23 | return srv.Send(resp) |
| 24 | }) |
| 25 | } |
| 26 | |
| 27 | return g.Wait() |
| 28 | } |
| 29 | |
| 30 | func (s *Server) forwardQuery(ctx context.Context, instID string, idx int, qry *runtimev1.Query) *runtimev1.QueryBatchResponse { |
| 31 | var err error |
nothing calls this directly
no test coverage detected