Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion router/core/graphql_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,15 @@ func (h *GraphQLHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
}

info, err := h.executor.Resolver.ArenaResolveGraphQLResponse(resolveCtx, p.Response, hpw)
var (
info *resolve.GraphQLResolveInfo
err error
)
if bytecodePlan := reqCtx.operation.preparedPlan.bytecodePlan; bytecodePlan.FastPathReady() {
info, err = h.executor.Resolver.ArenaResolveGraphQLResponseBytecode(resolveCtx, p.Response, bytecodePlan, hpw)
} else {
info, err = h.executor.Resolver.ArenaResolveGraphQLResponse(resolveCtx, p.Response, hpw)
}
reqCtx.dataSourceNames = getSubgraphNames(p.Response.DataSources)
if err != nil {
trackFinalResponseError(resolveCtx.Context(), err)
Expand Down
8 changes: 8 additions & 0 deletions router/core/operation_planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ import (
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
"github.com/wundergraph/graphql-go-tools/v2/pkg/astparser"
"github.com/wundergraph/graphql-go-tools/v2/pkg/engine/plan"
"github.com/wundergraph/graphql-go-tools/v2/pkg/engine/planbytecode"
"github.com/wundergraph/graphql-go-tools/v2/pkg/engine/planbytecode/compiler"
"github.com/wundergraph/graphql-go-tools/v2/pkg/engine/postprocess"
"github.com/wundergraph/graphql-go-tools/v2/pkg/engine/resolve"
)

type planWithMetaData struct {
preparedPlan plan.Plan
bytecodePlan *planbytecode.Program
operationDocument, schemaDocument *ast.Document
typeFieldUsageInfo []*graphqlschemausage.TypeFieldUsageInfo
argumentUsageInfo []*graphqlmetricsv1.ArgumentUsageInfo
Expand Down Expand Up @@ -92,9 +95,14 @@ func (p *OperationPlanner) planOperation(content string, name string, includeQue
}
post := postprocess.NewProcessor(postprocess.CollectDataSourceInfo())
post.Process(preparedPlan)
bytecodePlan, err := compiler.Compile(preparedPlan)
if err != nil {
return nil, err
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

return &planWithMetaData{
preparedPlan: preparedPlan,
bytecodePlan: bytecodePlan,
operationDocument: &doc,
schemaDocument: p.executor.RouterSchema,
}, nil
Expand Down
Loading