Skip to content
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

perf: skip handler return value validation #6671

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 6 additions & 5 deletions core/src/router/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export abstract class BaseActionRouter<K extends ActionKind> extends BaseRouter
handler: GetActionTypeHandler<ActionTypeClasses<K>[T], any>
) {
const pluginName = plugin.name
const schema = this.handlerDescriptions[handlerType].resultSchema
// const schema = this.handlerDescriptions[handlerType].resultSchema

// Wrap the handler with identifying attributes
const wrapped = Object.assign(
Expand All @@ -375,10 +375,11 @@ export abstract class BaseActionRouter<K extends ActionKind> extends BaseRouter
)} handler on ${pluginName} provider. Called with ${args.length} arguments.`,
})
}
const kind = this.kind
return validateSchema(result, schema, {
context: `${String(handlerType)} handler output from provider ${pluginName} for ${kind} type ${actionType}`,
})
// const kind = this.kind
// return validateSchema(result, schema, {
// context: `${String(handlerType)} handler output from provider ${pluginName} for ${kind} type ${actionType}`,
// })
return result
})),
{ handlerType, pluginName, actionType }
)
Expand Down
9 changes: 5 additions & 4 deletions core/src/router/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class ModuleRouter extends BaseRouter {
handler: ModuleActionHandlers[T]
) {
const pluginName = plugin.name
const schema = this.moduleHandlerDescriptions[handlerType].resultSchema
// const schema = this.moduleHandlerDescriptions[handlerType].resultSchema

// Wrap the handler with identifying attributes
const wrapped = Object.assign(
Expand All @@ -183,9 +183,10 @@ export class ModuleRouter extends BaseRouter {
message: `Got empty response from ${moduleType}.${handlerType} handler (called with ${args.length} args) on ${pluginName} provider.`,
})
}
return validateSchema(result, schema, {
context: `${handlerType} handler output from provider ${pluginName} for module type ${moduleType} `,
})
// return validateSchema(result, schema, {
// context: `${handlerType} handler output from provider ${pluginName} for module type ${moduleType} `,
// })
return result
}),
{ handlerType, pluginName, moduleType, wrapped: handler }
)
Expand Down
5 changes: 3 additions & 2 deletions core/src/router/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class ProviderRouter extends BaseRouter {
handler: ProviderHandlers[T]
) {
const pluginName = plugin.name
const schema = this.pluginHandlerDescriptions[handlerType].resultSchema
// const schema = this.pluginHandlerDescriptions[handlerType].resultSchema

// Wrap the handler with identifying attributes
const wrapped: WrappedPluginHandlers[T] = Object.assign(
Expand All @@ -255,7 +255,8 @@ export class ProviderRouter extends BaseRouter {
message: `Got empty response from ${handlerType} handler on ${pluginName} provider. Called with ${args.length} args.`,
})
}
return validateSchema(result, schema, { context: `${handlerType} output from plugin ${pluginName}` })
// return validateSchema(result, schema, { context: `${handlerType} output from plugin ${pluginName}` })
return result
},
{ handlerType, pluginName }
) as WrappedPluginHandlers[T]
Expand Down
1 change: 0 additions & 1 deletion core/test/integ/src/plugins/kubernetes/helm/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ describe("configureHelmModule", () => {
dependencies: [],
disabled: false,
sourceModuleName: "api-image",
timeout: DEFAULT_DEPLOY_TIMEOUT_SEC,
spec: expectedSpec,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ describe("configureKubernetesModule", () => {
tasks: [taskSpec],
timeout: 300,
},
timeout: DEFAULT_DEPLOY_TIMEOUT_SEC,
},
])

Expand Down