Comparing version 0.9.4 to 0.9.5
@@ -6,2 +6,3 @@ var debug = require('debug')('rascal:Vhost') | ||
var async = require('async') | ||
var forwardEvents = require('forward-emitter') | ||
var tasks = require('./tasks') | ||
@@ -33,5 +34,9 @@ | ||
if (err) return next(err) | ||
self.emit('connect') | ||
// TODO its possible a connection error has already triggered an init cycle, so may need to disconnect again | ||
ctx.connection.removeAllListeners('error') | ||
ctx.connection.once('error', handleConnectionError.bind(null, config)) | ||
forwardEvents(ctx.connection, self, function(eventName) { | ||
return eventName === 'blocked' || eventName === 'unblocked'; | ||
}) | ||
connection = ctx.connection | ||
@@ -104,2 +109,3 @@ channelAllocator.resume() | ||
debug(format('Handling connection error: %s from %s', err.message, config.connection.loggableUrl)) | ||
self.emit('disconnect') | ||
channelAllocator.pause() | ||
@@ -106,0 +112,0 @@ connection = undefined |
{ | ||
"name": "rascal", | ||
"version": "0.9.4", | ||
"version": "0.9.5", | ||
"description": "A friendly wrapper around amqplib with (mostly) safe defaults", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
246633
5336