spool-retry
A Spool to make it easy to use Retries with Fabrix
Install
$ npm install --save @fabrix/spool-retry
Configure
// config/main.ts
import { RetrySpool } from '@fabrix/spool-retry'
export const main = {
spools: [
// ... other spools
RetrySpool
]
}
Configuration
// config/retry.ts
export const retry = {
// retries: The maximum amount of times to retry the operation. Default is 10.
retries: null, // 10,
// factor: The exponential factor to use. Default is 2.
factor: null, // 2,
// minTimeout: The number of milliseconds before starting the first retry. Default is 1000.
minTimeout: null, // 1000,
// maxTimeout: The maximum number of milliseconds between two retries. Default is Infinity.
maxTimeout: null,
// randomize: Randomizes the timeouts by multiplying with a factor between 1 to 2. Default is false.
randomize: false
}
For more information about store (type and configuration) please see the retry documentation.
Usage
For the best results, create a Board Class and override the default methods.
import { RetryManager } from '@fabrix/spool-retry'
export class Retry extends RetryManager {
}
this.app.retries.MyRetry.attemtp(func, params)