New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dbqueue

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dbqueue - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

11

main.js

@@ -12,2 +12,3 @@ 'use strict';

this.deserializer = attrs.deserializer || JSON.parse;
this.persist_last_error = attrs.persist_last_error || false;

@@ -151,3 +152,11 @@ var pool = mysql.createPool(attrs);

if (err) {
return;
if (!self.persist_last_error) {
return;
}
return self.query("UPDATE ?? SET last_error = ? WHERE id = ?", [table, (err || '').toString(), job.id], function(err, result) {
if (err) {
console.error('Error recording last_error:', err, err.stack);
}
});
}

@@ -154,0 +163,0 @@

2

package.json
{
"name": "dbqueue",
"version": "4.0.0",
"version": "5.0.0",
"description": "A minimal, durable DB-based message queue system",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/elliotf/node-dbqueue",

@@ -47,18 +47,2 @@ 'use strict';

});
context('when the database hostname is invalid', function() {
it('yields an error rather than throw an exception', function(done) {
var config = _.extend({}, helper.test_db_config, {
host: 'fake-domain-here.example',
});
DBQueue.connect(config, function(err, queue) {
expect(err).to.exist();
expect(err.code).to.equal('ENOTFOUND');
return done();
});
});
});
});

@@ -91,2 +75,3 @@

data: '{"example":"message data"}',
last_error: null,
queue: 'waffles',

@@ -313,2 +298,41 @@ worker: 'unassigned',

});
context('when the persist_last_error option has been specified', function() {
beforeEach(function(done) {
var custom_config = _.extend({}, helper.test_db_config, {
persist_last_error: true,
});
DBQueue.connect(custom_config, function(err, result) {
expect(err).to.not.exist();
queue = result;
return done();
});
});
it('should store that error in the `last_error` column', function(done) {
queue.consume('queue_a', function(err, job, finishedWithJob) {
expect(err).to.not.exist();
finishedWithJob(new Error('fake error'));
setTimeout(function(err) {
expect(err).to.not.exist();
db.query('SELECT last_error FROM jobs WHERE queue = ?', ['queue_a'], function(err, rows) {
expect(err).to.not.exist();
expect(rows).to.deep.equal([
{
last_error: 'Error: fake error',
},
]);
return done();
});
},10);
});
});
});
});

@@ -315,0 +339,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc