Created
April 3, 2018 21:30
-
-
Save RobsonX4/f6d939c5fb4c1e2b93d00009856fc5d0 to your computer and use it in GitHub Desktop.
cron agenda example
This file contains hidden or 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
| const Agenda = require('agenda'); | |
| const agenda = new Agenda({db: { address: 'mongodb://user:pwd@host:port/database' }}); | |
| agenda.define('make something', (job, done) => { | |
| console.log("I'am working", new Date()); | |
| done(); | |
| }); | |
| agenda.on('ready', () => { | |
| agenda.every('2 seconds', 'make something'); | |
| agenda.start(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment