Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

Commit

Permalink
Propagate errors from backend connection (#81)
Browse files Browse the repository at this point in the history
* Use same BROKER_OPTIONS for backend connection

* Remove block that should never happen

And wouldn’t work if it did

* Add error handling to backend connection
  • Loading branch information
holm authored and mher committed Mar 19, 2017
1 parent 4b21197 commit 96207bd
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions celery.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,15 @@ function Client(conf) {
self.emit('message', msg);
});
} else if (self.conf.backend_type === 'amqp') {
self.backend = amqp.createConnection({
url: self.conf.BROKER_URL,
heartbeat: 580
}, {
self.backend = amqp.createConnection(self.conf.BROKER_OPTIONS, {
defaultExchangeName: self.conf.DEFAULT_EXCHANGE
});
} else if (self.conf.backend_type === self.conf.broker_type) {
if (self.conf.backend_type === 'amqp') {
self.backend = self.broker;
}
}

self.backend.on('error', function(err) {
self.emit('error', err);
});

// backend ready...
self.backend.on('ready', function() {
debug('Connecting to broker...');
Expand Down

0 comments on commit 96207bd

Please sign in to comment.