Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

amqplib-easy

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amqplib-easy - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

test/resources/death.js

15

index.js

@@ -7,4 +7,19 @@ 'use strict';

retry = require('amqplib-retry'),
diehard = require('diehard'),
connections = {};
function cleanup(done) {
BPromise.map(
Object.keys(connections),
function (connectionUrl) {
return connections[connectionUrl]
.then(function (connection) {
return connection.close();
});
}
).nodeify(done);
}
diehard.register(cleanup);
module.exports = function (amqpUrl) {

@@ -11,0 +26,0 @@ function connect() {

3

package.json
{
"name": "amqplib-easy",
"version": "2.1.0",
"version": "2.2.0",
"description": "Simplified API for interacting with AMQP",

@@ -35,4 +35,5 @@ "main": "index.js",

"bluebird": "^2.6.2",
"diehard": "^1.1.2",
"lodash.defaults": "^2.4.1"
}
}

@@ -5,2 +5,3 @@ /*globals it:false*/

var amqpUrl = 'amqp://guest:guest@localhost:5672',
childProcess = require('child_process'),
BPromise = require('bluebird'),

@@ -105,1 +106,33 @@ amqp = require('../index')(amqpUrl);

});
describe('Connection managment', function () {
it('should reuse the existing connection', function (done) {
amqp.connect()
.then(function (connection1) {
amqp.connect()
.then(function (connection2) {
connection1.should.equal(connection2);
done();
});
})
.catch(done);
});
it('should close the connection upon death', function (done) {
this.timeout(3000);
// Spin up a process to kill
var testProcess = childProcess.fork('./test/resources/death.js', { silent: false });
testProcess.on('message', function (message) {
switch (message) {
case 'ok':
return done();
case 'ready':
return testProcess.kill('SIGTERM');
default:
return done(new Error('Unknown message ' + message));
}
});
});
});
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