Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Agenda - create multiple job definitions with same name, different job config
// Create each job with the same name so we can control concurrency (the number of parallel jobs that can be run).
// Each job will have the same name, but different configs. Use the 'unique' method to prevent duplicates.
agenda.define('MyJob', {concurrency: 3}, loadData);
_.each(myJobs, function(job){
agenda.create('MyJob', job)
.unique({'':}, { insertOnly: true })
.repeatEvery('1 hour')
// Custom job fail logic
agenda.on('fail:MyJob', function(err,job) {, " - Retrying job in 10 minutes");
job.attrs.nextRunAt = moment().add(10, 'minutes');;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.