Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
20 changes: 12 additions & 8 deletions execution/engine/execution_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ func (e *ExecutionEngine) Execute(ctx context.Context, operation *graphql.Reques
if report.HasErrors() {
return report
}
operation.ComputeStaticCost(costCalculator, e.config.plannerConfig, execContext.resolveContext.Variables)
// Debugging of cost trees. Do not remove.
// fmt.Println(costCalculator.DebugPrint(e.config.plannerConfig, execContext.resolveContext.Variables))
operation.ComputeEstimatedCost(costCalculator, e.config.plannerConfig, execContext.resolveContext.Variables)

if execContext.resolveContext.TracingOptions.Enable && !execContext.resolveContext.TracingOptions.ExcludePlannerStats {
planningTime := resolve.GetDurationNanoSinceTraceStart(execContext.resolveContext.Context()) - tracePlanStart
Expand All @@ -235,12 +233,18 @@ func (e *ExecutionEngine) Execute(ctx context.Context, operation *graphql.Reques

switch p := cachedPlan.(type) {
case *plan.SynchronousResponsePlan:
_, err := e.resolver.ResolveGraphQLResponse(execContext.resolveContext, p.Response, nil, writer)
return err
resp, err := e.resolver.ResolveGraphQLResponse(execContext.resolveContext, p.Response, nil, writer)
if err != nil {
return err
}
if resp != nil {
operation.ComputeActualCost(costCalculator, e.config.plannerConfig, resp.ActualListSizes)
}
return nil
Comment thread
coderabbitai[bot] marked this conversation as resolved.
case *plan.SubscriptionResponsePlan:
return e.resolver.ResolveGraphQLSubscription(execContext.resolveContext, p.Response, writer)
default:
return errors.New("execution of operation is not possible")
return errors.New("execution impossible: unknown type of operation")
}
}

Expand All @@ -258,7 +262,7 @@ func (e *ExecutionEngine) getCachedPlan(ctx *internalExecutionContext, operation

if cached, ok := e.executionPlanCache.Get(cacheKey); ok {
if p, ok := cached.(plan.Plan); ok {
return p, p.GetStaticCostCalculator()
return p, p.GetCostCalculator()
}
}

Expand All @@ -270,7 +274,7 @@ func (e *ExecutionEngine) getCachedPlan(ctx *internalExecutionContext, operation

ctx.postProcessor.Process(planResult)
e.executionPlanCache.Add(cacheKey, planResult)
return planResult, planResult.GetStaticCostCalculator()
return planResult, planResult.GetCostCalculator()
}

func (e *ExecutionEngine) GetWebsocketBeforeStartHook() WebsocketBeforeStartHook {
Expand Down
Loading