Comparing version 0.4.0 to 0.4.1
0.4.1 / 2013-12-10 | ||
================== | ||
* Added support for synchronous job definitions | ||
0.4.0 / 2013-12-04 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -82,3 +82,4 @@ var humanInterval = require('human-interval'), | ||
try { | ||
definition.fn(self, function() { | ||
var jobFinishedSuccessfully = function(err) { | ||
if(err) throw err; | ||
now = new Date(); | ||
@@ -91,3 +92,9 @@ agenda._runningJobs--; | ||
agenda.emit('success:' + self.attrs.name, self); | ||
}); | ||
}; | ||
if(definition.fn.length == 2) { | ||
definition.fn(self, jobFinishedSuccessfully); | ||
} else { | ||
definition.fn(self); | ||
jobFinishedSuccessfully(); | ||
} | ||
} catch(e) { | ||
@@ -94,0 +101,0 @@ now = new Date(); |
{ | ||
"name": "agenda", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Light weight job scheduler for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -159,3 +159,4 @@ # Agenda | ||
will be passed to `fn(job, done)`. To maintain asynchronous behavior, you must | ||
call `done()` when you are processing the job. | ||
call `done()` when you are processing the job. If your function is synchronous, | ||
you may omit `done` from the signature. | ||
@@ -181,2 +182,3 @@ `options` is an optional argument which can overwrite the defaults. It can take | ||
Async Job: | ||
```js | ||
@@ -192,2 +194,10 @@ agenda.define('some long running job', function(job, done) { | ||
Sync Job: | ||
```js | ||
agenda.define('say hello', function(job) { | ||
console.log("Hello!"); | ||
}); | ||
``` | ||
## Creating Jobs | ||
@@ -194,0 +204,0 @@ |
@@ -203,3 +203,3 @@ var expect = require('expect.js'), | ||
describe.only('computeNextRunAt', function() { | ||
describe('computeNextRunAt', function() { | ||
var job; | ||
@@ -206,0 +206,0 @@ |
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
33145
642
411