fix(orchestrator): save checkpoint before async step (#12138)
This commit is contained in:
committed by
GitHub
parent
07252691c5
commit
31abba8cde
@@ -204,7 +204,7 @@ export class WorkflowOrchestratorService {
|
||||
|
||||
throwOnError ??= true
|
||||
context ??= {}
|
||||
context.transactionId ??= transactionId ?? ulid()
|
||||
context.transactionId = transactionId ?? ulid()
|
||||
|
||||
const workflowId = isString(workflowIdOrWorkflow)
|
||||
? workflowIdOrWorkflow
|
||||
|
||||
@@ -95,24 +95,26 @@ export class WorkflowsModuleService<
|
||||
> = {},
|
||||
@MedusaContext() context: Context = {}
|
||||
) {
|
||||
options ??= {}
|
||||
const options_ = JSON.parse(JSON.stringify(options ?? {}))
|
||||
|
||||
const {
|
||||
manager,
|
||||
transactionManager,
|
||||
preventReleaseEvents,
|
||||
transactionId,
|
||||
...restContext
|
||||
} = context
|
||||
|
||||
options.context ??= restContext
|
||||
options.context.preventReleaseEvents ??=
|
||||
!!options.context.parentStepIdempotencyKey
|
||||
delete options.context.parentStepIdempotencyKey
|
||||
options_.context ??= restContext
|
||||
options_.context.preventReleaseEvents ??=
|
||||
!!options_.context.parentStepIdempotencyKey
|
||||
delete options_.context.parentStepIdempotencyKey
|
||||
|
||||
const ret = await this.workflowOrchestratorService_.run<
|
||||
TWorkflow extends ReturnWorkflow<any, any, any>
|
||||
? UnwrapWorkflowInputDataType<TWorkflow>
|
||||
: unknown
|
||||
>(workflowIdOrWorkflow, options)
|
||||
>(workflowIdOrWorkflow, options_)
|
||||
|
||||
return ret as any
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user