-
Notifications
You must be signed in to change notification settings - Fork 28
add finalize to NadelTransform #693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9637dff
0c45938
964b82e
c588416
ef3b1d7
289e501
a8944c8
c9cc58f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import graphql.nadel.engine.transform.NadelRenameArgumentInputTypesTransform | |
| import graphql.nadel.engine.transform.NadelRenameTransform | ||
| import graphql.nadel.engine.transform.NadelServiceTypeFilterTransform | ||
| import graphql.nadel.engine.transform.NadelTransform | ||
| import graphql.nadel.engine.transform.NadelTransformServiceExecutionContext | ||
| import graphql.nadel.engine.transform.NadelTypeRenameResultTransform | ||
| import graphql.nadel.engine.transform.hydration.NadelHydrationTransform | ||
| import graphql.nadel.engine.transform.hydration.batch.NadelBatchHydrationTransform | ||
|
|
@@ -64,7 +65,8 @@ internal class NadelExecutionPlanFactory( | |
| ): NadelExecutionPlan { | ||
| val executionSteps: MutableMap<ExecutableNormalizedField, List<NadelExecutionPlan.Step<Any>>> = | ||
| mutableMapOf() | ||
|
|
||
| val transformContexts: MutableMap<NadelTransform<Any>, NadelTransformServiceExecutionContext?> = | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I feel like we should pass this into But either way nbd let's fix that later |
||
| mutableMapOf() | ||
| executionContext.timer.batch { timer -> | ||
| traverseQuery(rootField) { field -> | ||
| val steps = transformsWithTimingStepInfo.mapNotNull { transformWithTimingInfo -> | ||
|
|
@@ -75,6 +77,21 @@ internal class NadelExecutionPlanFactory( | |
| if (isSkipIncludeSpecialField(field) && ((transform as NadelTransform<*>) !is NadelSkipIncludeTransform)) { | ||
| null | ||
| } else { | ||
| val executionTransformContext = if (transformContexts.containsKey(transform)) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just without
|
||
| transformContexts[transform] | ||
| } else { | ||
| transformContexts.getOrPut(transform) { | ||
| transform.buildContext( | ||
| executionContext, | ||
| serviceExecutionContext, | ||
| executionBlueprint, | ||
| services, | ||
| service, | ||
| rootField, | ||
| serviceHydrationDetails | ||
| ) | ||
| } | ||
| } | ||
| val state = timer.time(step = transformWithTimingInfo.executionPlanTimingStep) { | ||
| transform.isApplicable( | ||
| executionContext, | ||
|
|
@@ -83,6 +100,7 @@ internal class NadelExecutionPlanFactory( | |
| services, | ||
| service, | ||
| field, | ||
| executionTransformContext, | ||
| serviceHydrationDetails, | ||
| ) | ||
| } | ||
|
|
@@ -97,6 +115,7 @@ internal class NadelExecutionPlanFactory( | |
| queryTransformTimingStep = transformWithTimingInfo.queryTransformTimingStep, | ||
| resultTransformTimingStep = transformWithTimingInfo.resultTransformTimingStep, | ||
| state = state, | ||
| executionTransformContext | ||
| ) | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should just have a
Map<NadelTransform, NadelTransformServiceExecutionContext>instead of storing this in everyStep