fix(): Identify step that should require a save on checkpoint (#14037)
* fix(): Identify step that force save checkpoint * Create sour-peas-provide.md
This commit is contained in:
committed by
GitHub
parent
4e1c474dfa
commit
1ea932a56f
@@ -1504,16 +1504,13 @@ export class TransactionOrchestrator extends EventEmitter {
|
||||
const hasTransactionTimeout = !!this.options.timeout
|
||||
const isIdempotent = !!this.options.idempotent
|
||||
|
||||
if (hasAsyncSteps) {
|
||||
this.options.store = true
|
||||
}
|
||||
|
||||
if (
|
||||
hasStepTimeouts ||
|
||||
hasRetriesTimeout ||
|
||||
hasTransactionTimeout ||
|
||||
isIdempotent ||
|
||||
this.options.retentionTime
|
||||
this.options.retentionTime ||
|
||||
hasAsyncSteps
|
||||
) {
|
||||
this.options.store = true
|
||||
}
|
||||
@@ -1628,6 +1625,12 @@ export class TransactionOrchestrator extends EventEmitter {
|
||||
const definitionCopy = { ...obj } as TransactionStepsDefinition
|
||||
delete definitionCopy.next
|
||||
|
||||
const isAsync = !!definitionCopy.async
|
||||
const hasRetryInterval = !!(
|
||||
definitionCopy.retryInterval || definitionCopy.retryIntervalAwaiting
|
||||
)
|
||||
const hasTimeout = !!definitionCopy.timeout
|
||||
|
||||
if (definitionCopy.async) {
|
||||
features.hasAsyncSteps = true
|
||||
}
|
||||
@@ -1647,6 +1650,20 @@ export class TransactionOrchestrator extends EventEmitter {
|
||||
features.hasNestedTransactions = true
|
||||
}
|
||||
|
||||
/**
|
||||
* Force the checkpoint to save even for sync step when they have specific configurations.
|
||||
*/
|
||||
definitionCopy.store = !!(
|
||||
definitionCopy.store ||
|
||||
isAsync ||
|
||||
hasRetryInterval ||
|
||||
hasTimeout
|
||||
)
|
||||
|
||||
if (existingSteps?.[id]) {
|
||||
existingSteps[id].definition.store = definitionCopy.store
|
||||
}
|
||||
|
||||
states[id] = Object.assign(
|
||||
new TransactionStep(),
|
||||
existingSteps?.[id] || {
|
||||
|
||||
@@ -115,6 +115,12 @@ export type TransactionStepsDefinition = {
|
||||
*/
|
||||
next?: TransactionStepsDefinition | TransactionStepsDefinition[]
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Whether we need to store checkpoint at this step.
|
||||
*/
|
||||
store?: boolean
|
||||
|
||||
// TODO: add metadata field for customizations
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user