Optionalbackoffimport { backoffStrategies } from 'agenda';
// Using built-in exponential backoff
agenda.define('myJob', handler, {
backoff: backoffStrategies.exponential({ delay: 1000, maxRetries: 5 })
});
// Using a preset
agenda.define('myJob', handler, {
backoff: backoffStrategies.standard()
});
// Custom strategy
agenda.define('myJob', handler, {
backoff: (ctx) => ctx.attempt <= 3 ? 1000 * ctx.attempt : null
});
Optionalconcurrencyhow many jobs of this kind can run in parallel/simultanously per Agenda instance
lock lifetime in milliseconds
max number of locked jobs of this kind
OptionalpriorityHigher priority jobs will run first.
Backoff strategy for automatic retries on failure. Can be a built-in strategy from
backoffStrategiesor a custom function.