Skip to content

Commit

Permalink
Clear callback queue without error if explicitly closing fixes #824 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperlink authored Feb 6, 2018
1 parent d6f60ec commit d499a1b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/kafkaClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,14 @@ KafkaClient.prototype.createBroker = function (host, port, longpolling) {
});
socket.on('close', function (hadError) {
self.emit('close', this);
if (hadError) {
if (!hadError && self.closing) {
logger.debug(`clearing ${this.addr} callback queue without error`);
self.clearCallbackQueue(this);
} else {
self.clearCallbackQueue(
this,
this.error != null ? this.error : new errors.BrokerNotAvailableError('Broker not available')
);
} else {
logger.debug(`clearing ${this.addr} callback queue without error`);
self.clearCallbackQueue(this);
}
retry(this);
});
Expand Down

0 comments on commit d499a1b

Please sign in to comment.