| language: node_js | ||
| services: mongodb | ||
| node_js: | ||
| - "0.11" | ||
| - "0.10" | ||
| - "0.8" |
+5
-0
| 0.1.2 / 2013-10-31 | ||
| ================== | ||
| * Updated write concern to avoid annoying notices | ||
| 0.1.1 / 2013-10-28 | ||
@@ -3,0 +8,0 @@ ================== |
+2
-2
@@ -15,3 +15,3 @@ var Job = require('./job.js'), | ||
| if(config.db) | ||
| this._db = mongo.db(config.db.address).collection(config.db.collection || 'agendaJobs'); | ||
| this.database(config.db.address, config.db.collection); | ||
| }; | ||
@@ -23,3 +23,3 @@ | ||
| collection = collection || 'agendaJobs'; | ||
| this._db = mongo.db(url).collection(collection); | ||
| this._db = mongo.db(url, {w: 0}).collection(collection); | ||
| return this; | ||
@@ -26,0 +26,0 @@ }; |
+1
-1
| { | ||
| "name": "agenda", | ||
| "version": "0.1.1", | ||
| "version": "0.1.2", | ||
| "description": "Light weight job scheduler for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+36
-2
| # Agenda | ||
| [](http://travis-ci.org/rschmukler/agenda) | ||
| Agenda is a light-weight job scheduling library for Node.js. | ||
@@ -26,2 +29,4 @@ | ||
| agenda.every('3 minutes', 'delete old users'); | ||
| agenda.start(); | ||
| ``` | ||
@@ -37,6 +42,7 @@ | ||
| body: '...' | ||
| } | ||
| }, done); | ||
| }); | ||
| agenda.schedule('in 20 minutes', 'send email report', {to: 'admin@example.com'}); | ||
| agenda.start(); | ||
| ``` | ||
@@ -47,2 +53,3 @@ | ||
| weeklyReport.repeatEvery('1 week').save(); | ||
| agenda.start(); | ||
| ``` | ||
@@ -59,2 +66,3 @@ | ||
| - [Creating jobs](#creating-jobs) | ||
| - [Starting the job processor](#starting-the-job-processor) | ||
| - [Manually working with jobs](#manually-working-with-a-job) | ||
@@ -119,3 +127,3 @@ | ||
| ```js | ||
| var agenda = new Agenda({processEvery: 20}); | ||
| var agenda = new Agenda({maxConcurrency: 20}); | ||
| ``` | ||
@@ -168,2 +176,12 @@ | ||
| ```js | ||
| agenda.define('some long running job', function(job, done) { | ||
| doSomelengthyTask(function(data) { | ||
| formatThatData(data); | ||
| sendThatData(data); | ||
| done(); | ||
| }); | ||
| }); | ||
| ``` | ||
| ## Creating Jobs | ||
@@ -221,2 +239,18 @@ | ||
| ## Starting the job processor | ||
| To get agenda to start processing jobs from the database you must start it. This | ||
| will schedule an interval (based on `processEvery`) to check for new jobs and | ||
| run them. You can also stop the queue. | ||
| ### start | ||
| Starts the job queue processing, checking `processEvery` time to see if there | ||
| are new jobs. | ||
| ### stop | ||
| Stops the job queue processing. | ||
| ## Manually working with a job | ||
@@ -223,0 +257,0 @@ |
+1
-1
| var expect = require('expect.js'), | ||
| mongo = require('mongoskin').db('localhost:27017/agenda-test'); | ||
| mongo = require('mongoskin').db('localhost:27017/agenda-test', {w: 0}); | ||
| jobs = require('../index.js')({ | ||
@@ -4,0 +4,0 @@ defaultConcurrency: 5, |
24774
3.94%10
11.11%336
11.26%