fix(): Properly handle workflow as step now that events are fixed entirely (#12196)

**What**
Now that all events management are fixed in the workflows life cycle, the run as step needs to leverage the workflow engine if present (which should always be the case for async workflows) in order to ensure the continuation and the ability to mark parent step in parent workflow as success or failure

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
Adrien de Peretti
2025-04-17 11:34:19 +02:00
committed by GitHub
parent 9abcf7a83a
commit 8618e6ee38
16 changed files with 410 additions and 145 deletions

View File

@@ -310,10 +310,16 @@ export class InMemoryDistributedTransactionStorage
const { modelId: workflowId, transactionId } = transaction
const inter = setTimeout(async () => {
const context = transaction.getFlow().metadata ?? {}
await this.workflowOrchestratorService_.run(workflowId, {
transactionId,
logOnError: true,
throwOnError: false,
context: {
eventGroupId: context.eventGroupId,
parentStepIdempotencyKey: context.parentStepIdempotencyKey,
preventReleaseEvents: context.preventReleaseEvents,
},
})
}, interval * 1e3)
@@ -343,9 +349,16 @@ export class InMemoryDistributedTransactionStorage
const { modelId: workflowId, transactionId } = transaction
const inter = setTimeout(async () => {
const context = transaction.getFlow().metadata ?? {}
await this.workflowOrchestratorService_.run(workflowId, {
transactionId,
logOnError: true,
throwOnError: false,
context: {
eventGroupId: context.eventGroupId,
parentStepIdempotencyKey: context.parentStepIdempotencyKey,
preventReleaseEvents: context.preventReleaseEvents,
},
})
}, interval * 1e3)
@@ -375,9 +388,16 @@ export class InMemoryDistributedTransactionStorage
const { modelId: workflowId, transactionId } = transaction
const inter = setTimeout(async () => {
const context = transaction.getFlow().metadata ?? {}
await this.workflowOrchestratorService_.run(workflowId, {
transactionId,
logOnError: true,
throwOnError: false,
context: {
eventGroupId: context.eventGroupId,
parentStepIdempotencyKey: context.parentStepIdempotencyKey,
preventReleaseEvents: context.preventReleaseEvents,
},
})
}, interval * 1e3)