Skip to content

Commit

Permalink
fixes noodlefrenzy#358 - the connection:opened event should be emited…
Browse files Browse the repository at this point in the history
… after all

operations ?
  • Loading branch information
karlvlam committed Mar 12, 2018
1 parent e61b5ff commit 86ed765
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/amqp_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ AMQPClient.prototype.connect = function(url, policyOverrides) {
self._connection = self._newConnection(connectPolicy);
self._connection.on(Connection.Connected, function(c) {
debug('connected');
self.emit(AMQPClient.ConnectionOpened);

var promises = [];

Expand Down Expand Up @@ -213,10 +212,12 @@ AMQPClient.prototype.connect = function(url, policyOverrides) {
Promise.all(promises).then(function() {
self.emit('connected');
resolve(self);
self.emit(AMQPClient.ConnectionOpened);
}).catch(reject);
} else {
self.emit('connected');
resolve(self);
self.emit(AMQPClient.ConnectionOpened);
}
});

Expand Down

0 comments on commit 86ed765

Please sign in to comment.