Skip to content

Commit

Permalink
Catch assign error
Browse files Browse the repository at this point in the history
Issue: BB-441
  • Loading branch information
francoisferrand committed Oct 5, 2023
1 parent 77b4db5 commit 6162a05
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/BackbeatConsumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,17 @@ class BackbeatConsumer extends EventEmitter {
'rebalance_cb': (err, assignment) => {

Check warning on line 183 in lib/BackbeatConsumer.js

View workflow job for this annotation

GitHub Actions / tests

Expected to return a value at the end of method 'rebalance_cb'
if (err.code === kafka.CODES.ERRORS.ERR__ASSIGN_PARTITIONS) {
this._log.debug('rdkafka.assign', { err, assignment });
this._consumer.assign(assignment);

try {
this._consumer.assign(assignment);
} catch (e) {
// Ignore exceptions if we are not connected
if (this._consumer.isConnected()) {
this._log.error('rdkafka.assign failed', { err, e, assignment });
} else {
this._log.debug('rdkafka.assign failed while !connected', { err, e, assignment });
}
}
} else if (err.code === kafka.CODES.ERRORS.ERR__REVOKE_PARTITIONS) {
this._log.debug('rdkafka.revoke', { err });

Expand Down

0 comments on commit 6162a05

Please sign in to comment.