fix(orchestration): Use the step definition max retries on set step failure (#13319)
* fix(orchestration): Use the step definition max retries on set step failure * Create sweet-turkeys-wait.md * allow to force permanent failure * update changeset
This commit is contained in:
committed by
GitHub
parent
cbaa403744
commit
ff152e7ace
@@ -1795,12 +1795,14 @@ export class TransactionOrchestrator extends EventEmitter {
|
||||
handler,
|
||||
transaction,
|
||||
onLoad,
|
||||
forcePermanentFailure,
|
||||
}: {
|
||||
responseIdempotencyKey: string
|
||||
error?: Error | any
|
||||
handler?: TransactionStepHandler
|
||||
transaction?: DistributedTransactionType
|
||||
onLoad?: (transaction: DistributedTransactionType) => Promise<void> | void
|
||||
forcePermanentFailure?: boolean
|
||||
}): Promise<DistributedTransactionType> {
|
||||
const [curTransaction, step] =
|
||||
await TransactionOrchestrator.getTransactionAndStepFromIdempotencyKey(
|
||||
@@ -1822,7 +1824,8 @@ export class TransactionOrchestrator extends EventEmitter {
|
||||
curTransaction,
|
||||
step,
|
||||
error,
|
||||
0
|
||||
// On permanent failure, the step should not consider any retries
|
||||
forcePermanentFailure ? 0 : step.definition.maxRetries
|
||||
)
|
||||
|
||||
if (ret.transactionIsCancelling) {
|
||||
|
||||
@@ -467,7 +467,8 @@ export class LocalWorkflow {
|
||||
idempotencyKey: string,
|
||||
error?: Error | any,
|
||||
context?: Context,
|
||||
subscribe?: DistributedTransactionEvents
|
||||
subscribe?: DistributedTransactionEvents,
|
||||
forcePermanentFailure?: boolean
|
||||
): Promise<DistributedTransactionType> {
|
||||
this.medusaContext = context
|
||||
const { handler, orchestrator } = this.workflow
|
||||
@@ -483,6 +484,7 @@ export class LocalWorkflow {
|
||||
error,
|
||||
handler: handler(this.container_, context),
|
||||
onLoad: this.onLoad.bind(this),
|
||||
forcePermanentFailure,
|
||||
})
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user