feat(workflows-sdk,orchestration): async step as background task (#6886)
This commit is contained in:
1 parent
3dcf5224a1
commit
a164c0d512
17 files changed
+290
-34
No files matched your search
@@ -1,4 +1,5 @@
|
||||
export * from "./workflow_1"
|
||||
export * from "./workflow_2"
|
||||
export * from "./workflow_async"
|
||||
export * from "./workflow_step_timeout"
|
||||
export * from "./workflow_transaction_timeout"
|
||||
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
StepResponse,
|
||||
createStep,
|
||||
createWorkflow,
|
||||
} from "@medusajs/workflows-sdk"
|
||||
import { setTimeout } from "timers/promises"
|
||||
|
||||
const step_1_background = createStep(
|
||||
{
|
||||
name: "step_1_background",
|
||||
async: true,
|
||||
},
|
||||
jest.fn(async (input) => {
|
||||
await setTimeout(200)
|
||||
|
||||
return new StepResponse(input)
|
||||
})
|
||||
)
|
||||
|
||||
createWorkflow(
|
||||
{
|
||||
name: "workflow_async_background",
|
||||
},
|
||||
function (input) {
|
||||
const resp = step_1_background(input)
|
||||
|
||||
return resp
|
||||
}
|
||||
)
|
||||
Reference in new issue
Block a user