Skip to content

Commit

Permalink
Wrap ConsumerGroup.onRebalance to avoid waterfall bug (#922)
Browse files Browse the repository at this point in the history
If the onRebalance function yields a value, it would be reflected
into the waterfall and move the callback to the 2nd parameter.

see #918
  • Loading branch information
aikar authored and hyperlink committed Apr 10, 2018
1 parent 1531175 commit 0f5bce3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/consumerGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,12 @@ ConsumerGroup.prototype.connect = function () {
[
function (callback) {
if (typeof self.options.onRebalance === 'function') {
self.options.onRebalance(self.generationId != null && self.memberId != null, callback);
self.options.onRebalance(self.generationId != null && self.memberId != null, function (error) {
if (error) {
return callback(error);
}
callback(null);
});
return;
}
callback(null);
Expand Down

0 comments on commit 0f5bce3

Please # to comment.