fix(orchestrator, workflows-sdk): skip async step (#9482)
This commit is contained in:
1 parent
ad3524ffbe
commit
f9e8403d29
1 file changed
+10
-12
@@ -873,15 +873,19 @@ export class TransactionOrchestrator extends EventEmitter {
|
|||||||
promise = stepHandler()
|
promise = stepHandler()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO discussion why do we not await here, adding an await I wouldnt expect the test to fail but it does, maybe we should split the test to also test after everything is executed?
|
|
||||||
// cc test from engine redis
|
|
||||||
promise
|
promise
|
||||||
.then(async (response: any) => {
|
.then(async (response: any) => {
|
||||||
|
const output = response?.__type ? response.output : response
|
||||||
|
|
||||||
|
if (SkipStepResponse.isSkipStepResponse(output)) {
|
||||||
|
await TransactionOrchestrator.skipStep(transaction, step)
|
||||||
|
} else {
|
||||||
if (
|
if (
|
||||||
!step.definition.backgroundExecution ||
|
!step.definition.backgroundExecution ||
|
||||||
step.definition.nested
|
step.definition.nested
|
||||||
) {
|
) {
|
||||||
const eventName = DistributedTransactionEvent.STEP_AWAITING
|
const eventName =
|
||||||
|
DistributedTransactionEvent.STEP_AWAITING
|
||||||
transaction.emit(eventName, { step, transaction })
|
transaction.emit(eventName, { step, transaction })
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -895,14 +899,6 @@ export class TransactionOrchestrator extends EventEmitter {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
let setResponse = true
|
|
||||||
const output = response?.__type ? response.output : response
|
|
||||||
if (SkipStepResponse.isSkipStepResponse(output)) {
|
|
||||||
await TransactionOrchestrator.skipStep(transaction, step)
|
|
||||||
setResponse = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (setResponse) {
|
|
||||||
await TransactionOrchestrator.setStepSuccess(
|
await TransactionOrchestrator.setStepSuccess(
|
||||||
transaction,
|
transaction,
|
||||||
step,
|
step,
|
||||||
@@ -1148,7 +1144,9 @@ export class TransactionOrchestrator extends EventEmitter {
|
|||||||
queue.push({ obj: obj[key], level: [...level] })
|
queue.push({ obj: obj[key], level: [...level] })
|
||||||
} else if (key === "action") {
|
} else if (key === "action") {
|
||||||
if (actionNames.has(obj.action)) {
|
if (actionNames.has(obj.action)) {
|
||||||
throw new Error(`Step ${obj.action} is already defined in workflow.`)
|
throw new Error(
|
||||||
|
`Step ${obj.action} is already defined in workflow.`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
actionNames.add(obj.action)
|
actionNames.add(obj.action)
|
||||||
|
|||||||
Reference in new issue
Block a user