fix(orchestration): fix set step failure (#10031)
What: - copy data before saving checkpoint - removed unused data format function - properly handle registerStepFailure to not throw - emit onFinish event even when execution failed
This commit is contained in:
committed by
GitHub
parent
7794faf49e
commit
1eef324af3
@@ -2,6 +2,7 @@ import {
|
||||
createStep,
|
||||
createWorkflow,
|
||||
StepResponse,
|
||||
WorkflowResponse,
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
|
||||
const step_1 = createStep(
|
||||
@@ -49,6 +50,14 @@ const step_3 = createStep(
|
||||
})
|
||||
)
|
||||
|
||||
const broken_step_2 = createStep(
|
||||
"broken_step_2",
|
||||
jest.fn(() => {}),
|
||||
jest.fn((_, context) => {
|
||||
throw new Error("Broken compensation step")
|
||||
})
|
||||
)
|
||||
|
||||
createWorkflow(
|
||||
{
|
||||
name: "workflow_2",
|
||||
@@ -67,3 +76,19 @@ createWorkflow(
|
||||
return step_3(ret2)
|
||||
}
|
||||
)
|
||||
|
||||
createWorkflow(
|
||||
{
|
||||
name: "workflow_2_revert_fail",
|
||||
retentionTime: 1000,
|
||||
},
|
||||
function (input) {
|
||||
step_1(input)
|
||||
|
||||
broken_step_2().config({
|
||||
async: true,
|
||||
})
|
||||
|
||||
return new WorkflowResponse("done")
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user