forked from agenda/agenda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix agenda.every overwriting nextRunAt [closes agenda#70]
- Loading branch information
1 parent
0b4e9ea
commit 99d30dd
Showing
2 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var connStr = 'mongodb://localhost/agenda-test'; | ||
var Agenda = require('agenda'); | ||
|
||
var agenda = new Agenda({db: { address: connStr } }); | ||
|
||
agenda.define('5 minutes job', function(job, done) { | ||
console.log("Running 5 minutes job"); | ||
done(); | ||
}); | ||
|
||
agenda.define('10 minutes job', function(job, done) { | ||
console.log("Running 10 minutes job"); | ||
done(); | ||
}); | ||
|
||
agenda.define('once a day job', function(job, done) { | ||
console.log('ONCE A DAY RUNNING'); | ||
done(); | ||
}); | ||
|
||
agenda.every('5 minutes', '5 minutes job'); | ||
agenda.every('10 minutes', '10 minutes job'); | ||
agenda.every('0 5 * * 1-5', 'once a day job'); | ||
|
||
agenda.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters