Skip to content

Documentation / @andrew_l/mongo-transaction / WithTransactionOptions

Interface: WithTransactionOptions ​

Extends ​

  • Partial<RetryOnErrorConfig>

Properties ​

beforeRetryCallback()? ​

optional beforeRetryCallback: (attempt, lastAttempt) => Promise<void | unknown[]>

The function to execute before retry attempt; Allows to update parameters for the main function by returning then in an array

Parameters ​

attempt ​

number

lastAttempt ​

boolean

Returns ​

Promise<void | unknown[]>

Inherited from ​

Partial.beforeRetryCallback


delayFactor? ​

optional delayFactor: number

Delay multiply factor

Inherited from ​

Partial.delayFactor


delayMaxMs? ​

optional delayMaxMs: number

Delay max milliseconds

Inherited from ​

Partial.delayMaxMs


delayMinMs? ​

optional delayMinMs: number

Delay min milliseconds

Inherited from ​

Partial.delayMinMs


maxAttempts? ​

optional maxAttempts: number

Number of attempts to execute a function

Inherited from ​

Partial.maxAttempts


maxRetriesNumber? ​

optional maxRetriesNumber: number

Number of retries until the execution fails (initial + retries)

Deprecated ​

use maxAttempts

Inherited from ​

Partial.maxRetriesNumber


shouldRetryBasedOnError()? ​

optional shouldRetryBasedOnError: (error, attempt) => boolean

Error validation function. If returns true, the main callback's considered ready to be executed again

Parameters ​

error ​

unknown

attempt ​

number

Returns ​

boolean

Inherited from ​

Partial.shouldRetryBasedOnError