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

chore: upgrade workflow engine to 0.7.2 #3080

Merged
merged 1 commit into from
Feb 13, 2024
Merged
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ dist

# Others
**/.DS_Store

.dccache
sanpj2292 marked this conversation as resolved.
Show resolved Hide resolved

.idea

Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@ndhoule/extend": "^2.0.0",
"@pyroscope/nodejs": "^0.2.6",
"@rudderstack/integrations-lib": "^0.2.2",
"@rudderstack/workflow-engine": "^0.6.9",
"@rudderstack/workflow-engine": "^0.7.2",
"ajv": "^8.12.0",
"ajv-draft-04": "^1.0.0",
"ajv-formats": "^2.1.1",
Expand Down
15 changes: 11 additions & 4 deletions src/cdk/v2/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ export async function getWorkflowEngine(

const workflowEnginePromiseMap = new Map();

export function getCachedWorkflowEngine(
export async function getCachedWorkflowEngine(
destName: string,
feature: string,
bindings: Record<string, unknown> = {},
): WorkflowEngine {
): Promise<WorkflowEngine> {
// Create a new instance of the engine for the destination if needed
// TODO: Use cache to avoid long living engine objects
workflowEnginePromiseMap[destName] = workflowEnginePromiseMap[destName] || new Map();
if (!workflowEnginePromiseMap[destName][feature]) {
workflowEnginePromiseMap[destName][feature] = getWorkflowEngine(destName, feature, bindings);
workflowEnginePromiseMap[destName][feature] = await getWorkflowEngine(
destName,
feature,
bindings,
);
}
return workflowEnginePromiseMap[destName][feature];
}
Expand Down Expand Up @@ -97,5 +101,8 @@ export function executeStep(
): Promise<StepOutput> {
return workflowEngine
.getStepExecutor(stepName)
.execute(input, Object.assign(workflowEngine.bindings, getEmptyExecutionBindings(), bindings));
.execute(
input,
Object.assign(workflowEngine.getBindings(), getEmptyExecutionBindings(), bindings),
);
}
Loading