Comparing version 0.1.3 to 0.2.0
0.2.0 / 2013-11-07 | ||
================== | ||
* Added error for running undefined job. [Closes #4] | ||
* Fixed critical error where new jobs are not correctly saved. | ||
0.1.3 / 2013-11-06 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -104,5 +104,8 @@ var Job = require('./job.js'), | ||
else { | ||
var query = {}; | ||
if(job.attrs._id) query._id = job.attrs._id; | ||
this._db.findAndModify(query, {$set: props}, {upsert: true, new: true}, processDbResult); | ||
if(job.attrs._id) { | ||
this._db.findAndModify({_id: job.attrs._id}, {}, {$set: props}, processDbResult); | ||
} | ||
else { | ||
this._db.insert(props, processDbResult); | ||
} | ||
} | ||
@@ -112,4 +115,9 @@ | ||
if(err) throw(err); | ||
else if(res && typeof res == 'object') | ||
job.attrs._id = res._id; | ||
else if(res) { | ||
if (Array.isArray(res)) { | ||
job.attrs._id = res[0]._id; | ||
} else if(typeof res == 'object') { | ||
job.attrs._id = res._id; | ||
} | ||
} | ||
@@ -158,2 +166,3 @@ if(fn) | ||
definition = definitions[jobs[index].attrs.name]; | ||
if(!definition) throw new Error("Attempted to run job undefined job: " + jobs[index].attrs.name); | ||
if(definition.concurrency > definition.running) { | ||
@@ -160,0 +169,0 @@ job = jobs[index]; |
{ | ||
"name": "agenda", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Light weight job scheduler for Node.js", | ||
@@ -19,9 +19,6 @@ "main": "index.js", | ||
"job", | ||
"jobs", | ||
"delayed", | ||
"job", | ||
"job", | ||
"scheduler", | ||
"job", | ||
"runner", | ||
"delayed" | ||
"runner" | ||
], | ||
@@ -28,0 +25,0 @@ "author": "Ryan Schmukler <ryan@slingingcode.com> (http://slingingcode.com/)", |
@@ -91,2 +91,4 @@ var expect = require('expect.js'), | ||
jobs.define('someJob', jobProcessor); | ||
jobs.define('send email', jobProcessor); | ||
jobs.define('some job', jobProcessor); | ||
}); | ||
@@ -163,3 +165,2 @@ | ||
it('sets the repeat interval', function() { | ||
debugger; | ||
job.repeatEvery(5000); | ||
@@ -166,0 +167,0 @@ expect(job.attrs.repeatInterval).to.be(5000); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27152
521