diff --git a/batch/pubsub/job-publisher.js b/batch/pubsub/job-publisher.js index 14b16448..45e2cefd 100644 --- a/batch/pubsub/job-publisher.js +++ b/batch/pubsub/job-publisher.js @@ -19,12 +19,13 @@ JobPublisher.prototype.publish = function (host) { } client.publish(self.channel, host, function (err) { + self.pool.release(DB, client); + if (err) { return error('Error publishing to ' + self.channel + ':' + host + ', ' + err.message); } debug('publish to ' + self.channel + ':' + host); - self.pool.release(DB, client); }); }); };