fix(workflow-engine-*): Prevent passing shared context reference (#11873)
* fix(workflow-engine-*): Prevent passing shared context reference * fix(workflow-engine-*): Prevent passing shared context reference * prevent tests from hanging * fix event handling * add integration tests * use interval for scheduled in tests * skip tests for now * Create silent-glasses-enjoy.md * fix cancel * changeset * push multiple aliases * test multiple field alias * increase wait time to index on test --------- Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com> Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
This commit is contained in:
committed by
GitHub
parent
2a18a75353
commit
13e159d8ad
@@ -91,9 +91,10 @@ function createContextualWorkflowRunner<
|
||||
flow.container = executionContainer
|
||||
}
|
||||
|
||||
const { eventGroupId, parentStepIdempotencyKey } = context
|
||||
const { eventGroupId, parentStepIdempotencyKey, preventReleaseEvents } =
|
||||
context
|
||||
|
||||
if (!parentStepIdempotencyKey) {
|
||||
if (!preventReleaseEvents) {
|
||||
attachOnFinishReleaseEvents(events, flow, { logOnError })
|
||||
}
|
||||
|
||||
|
||||
@@ -196,6 +196,7 @@ export function createWorkflow<TData, TResult, THooks extends any[]>(
|
||||
transactionId:
|
||||
step.__step__ + "-" + (stepContext.transactionId ?? ulid()),
|
||||
parentStepIdempotencyKey: stepContext.idempotencyKey,
|
||||
preventReleaseEvents: true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -207,15 +208,12 @@ export function createWorkflow<TData, TResult, THooks extends any[]>(
|
||||
)
|
||||
},
|
||||
async (transaction, stepContext) => {
|
||||
if (!transaction) {
|
||||
return
|
||||
}
|
||||
|
||||
const { container, ...sharedContext } = stepContext
|
||||
|
||||
const transactionId = step.__step__ + "-" + stepContext.transactionId
|
||||
await workflow(container).cancel({
|
||||
transaction: (transaction as WorkflowResult<any>).transaction,
|
||||
transactionId: isString(transaction) ? transaction : undefined,
|
||||
transaction: (transaction as WorkflowResult<any>)?.transaction,
|
||||
transactionId,
|
||||
container,
|
||||
context: {
|
||||
...sharedContext,
|
||||
|
||||
Reference in New Issue
Block a user