1
0
Fork 0
This commit is contained in:
Alan Plum 2015-05-27 12:50:42 +02:00
parent 9b5acdf25a
commit 2572ce9664
1 changed files with 3 additions and 4 deletions

View File

@ -203,7 +203,6 @@ function Queue(name) {
_.extend(Queue.prototype, { _.extend(Queue.prototype, {
push: function (name, data, opts) { push: function (name, data, opts) {
var type, result, now;
if (typeof name !== 'string') { if (typeof name !== 'string') {
throw new Error('Must pass a job type!'); throw new Error('Must pass a job type!');
} }
@ -215,11 +214,11 @@ _.extend(Queue.prototype, {
if (!jobTypeCache[dbName]) { if (!jobTypeCache[dbName]) {
jobTypeCache[dbName] = {}; jobTypeCache[dbName] = {};
} }
type = jobTypeCache[dbName][name]; var type = jobTypeCache[dbName][name];
if (type !== undefined) { if (type !== undefined) {
if (type.schema) { if (type.schema) {
result = type.schema.validate(data); var result = type.schema.validate(data);
if (result.error) { if (result.error) {
throw result.error; throw result.error;
} }
@ -234,7 +233,7 @@ _.extend(Queue.prototype, {
throw new Error('Unknown job type: ' + name); throw new Error('Unknown job type: ' + name);
} }
resetQueueControl(); resetQueueControl();
now = Date.now(); var now = Date.now();
return db._jobs.save({ return db._jobs.save({
status: 'pending', status: 'pending',
queue: this.name, queue: this.name,