fix(workflow-engines): race condition when retry interval is used (#11771)

This commit is contained in:
Adrien de Peretti
2025-03-12 09:53:34 -03:00
committed by GitHub
parent c97eaa0e0d
commit 72d2cf9207
24 changed files with 1130 additions and 235 deletions
@@ -31,9 +31,14 @@ export type FlowRegisterStepFailureOptions<TData = unknown> =
response?: TData
}
export type FlowCancelOptions = BaseFlowRunOptions & {
export type FlowCancelOptions = {
transaction?: DistributedTransactionType
transactionId?: string
context?: Context
throwOnError?: boolean
logOnError?: boolean
events?: DistributedTransactionEvents
container?: LoadedModule[] | MedusaContainer
}
/**
@@ -192,8 +192,6 @@ export function applyStep<
ret.__step__ = newStepName
WorkflowManager.update(this.workflowId, this.flow, this.handlers)
//const confRef = proxify(ret)
if (global[OrchestrationUtils.SymbolMedusaWorkflowComposerCondition]) {
const flagSteps =
global[OrchestrationUtils.SymbolMedusaWorkflowComposerCondition].steps
@@ -334,11 +332,11 @@ function wrapConditionalStep(
* createStep,
* StepResponse
* } from "@medusajs/framework/workflows-sdk"
*
*
* interface CreateProductInput {
* title: string
* }
*
*
* export const createProductStep = createStep(
* "createProductStep",
* async function (
@@ -47,22 +47,22 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null
* createProductStep,
* getProductStep,
* } from "./steps"
*
*
* interface WorkflowInput {
* title: string
* }
*
*
* const myWorkflow = createWorkflow(
* "my-workflow",
* (input: WorkflowInput) => {
* // Everything here will be executed and resolved later
* // during the execution. Including the data access.
*
*
* const product = createProductStep(input)
* return new WorkflowResponse(getProductStep(product.id))
* }
* )
*
*
* export async function GET(
* req: MedusaRequest,
* res: MedusaResponse
@@ -73,7 +73,7 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null
* title: "Shirt"
* }
* })
*
*
* res.json({
* product
* })