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:
Carlos R. L. Rodrigues
2024-11-12 07:06:36 -03:00
committed by GitHub
parent 7794faf49e
commit 1eef324af3
10 changed files with 217 additions and 212 deletions

View File

@@ -3,11 +3,14 @@ import {
createWorkflow,
StepResponse,
} from "@medusajs/framework/workflows-sdk"
import { setTimeout } from "timers/promises"
const step_1 = createStep(
"step_1",
jest.fn((input) => {
jest.fn(async (input) => {
input.test = "test"
await setTimeout(200)
return new StepResponse(input, { compensate: 123 })
}),
jest.fn((compensateInput) => {
@@ -27,9 +30,7 @@ createWorkflow(
timeout: 0.1, // 0.1 second
},
function (input) {
const resp = step_1(input).config({
async: true,
})
const resp = step_1(input)
return resp
}