Skip to content

Commit

Permalink
chore: upgrade workflow engine to 0.7.2 (#3080)
Browse files Browse the repository at this point in the history
  • Loading branch information
koladilip authored Feb 13, 2024
2 parents a98cabd + 8a8db1e commit fcc33cb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
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

.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),
);
}

0 comments on commit fcc33cb

Please sign in to comment.