Comparing version 0.1.9 to 0.1.10
{ | ||
"name": "jqueue", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "MySQL backed plugable Node.js job queue based on the Beanstalk Job Lifecycle", | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
@@ -33,3 +33,3 @@ var Queue = require('./queue'); | ||
dataType = 'TEXT'; | ||
storageEngine = 'MyISAM'; | ||
storageEngine = 'InnoDB'; | ||
} | ||
@@ -36,0 +36,0 @@ execQuery('CREATE TABLE IF NOT EXISTS ?? (\ |
@@ -179,16 +179,28 @@ var callBack = require('./callback'); | ||
} else { | ||
connection.beginTransaction(function (err) { | ||
connection.query('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE', function (err) { | ||
if (err) { | ||
cb(err); | ||
} else { | ||
connection.query('SELECT * FROM ?? \ | ||
connection.beginTransaction(function (err) { | ||
if (err) { | ||
cb(err); | ||
} else { | ||
connection.query('SELECT * FROM ?? \ | ||
WHERE (date_time <= CURRENT_TIMESTAMP AND status = ?) OR (time_to_run IS NOT NULL\ | ||
AND time_to_run < CURRENT_TIMESTAMP AND status = ?) ORDER BY priority desc,\ | ||
date_time asc LIMIT 1 FOR UPDATE', [queueName, 'ready', 'reserved'], function (error, data) { | ||
var message = data; | ||
if (!error && message && message.length) { | ||
message[0].status = 'reserved'; | ||
connection.query('UPDATE ?? SET status = ?, version = ?, \ | ||
var message = data; | ||
if (!error && message && message.length) { | ||
message[0].status = 'reserved'; | ||
connection.query('UPDATE ?? SET status = ?, version = ?, \ | ||
time_to_run = DATE_ADD(CURRENT_TIMESTAMP, INTERVAL ? SECOND) WHERE id = ?', | ||
[queueName, message[0].status, version, timeToRun, message[0].id], function (error) { | ||
[queueName, message[0].status, version, timeToRun, message[0].id], function (error) { | ||
connection.commit(function (err) { | ||
if (!err) { | ||
connection.release(); | ||
} | ||
cb(error, message); | ||
}); | ||
}); | ||
} else { | ||
connection.commit(function (err) { | ||
@@ -200,9 +212,3 @@ if (!err) { | ||
}); | ||
}); | ||
} else { | ||
connection.commit(function (err) { | ||
if (!err) { | ||
connection.release(); | ||
} | ||
cb(error, message); | ||
}); | ||
@@ -209,0 +215,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
55261
1385