Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kafka/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ class NodeNotReadyError(KafkaError):
retriable = True


class UnknownBrokerIdError(KafkaError):
pass


class QuotaViolationError(KafkaError):
pass

Expand Down
4 changes: 2 additions & 2 deletions kafka/net/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ async def _connect(self, node, conn):

def get_connection(self, node_id, pop_on_close=True, refresh_metadata_on_err=True):
if node_id is None:
raise Errors.NodeNotReadyError()
raise Errors.NodeNotReadyError('No node_id provided')
elif self.connection_delay(node_id) > 0:
raise Errors.NodeNotReadyError(node_id)
elif node_id in self._conns:
return self._conns[node_id]
node = self.cluster.broker_metadata(node_id)
if node is None:
raise Errors.NodeNotReadyError(node_id)
raise Errors.UnknownBrokerIdError(node_id)
conn = KafkaConnection(self._net, node_id=node_id, broker_version_data=self.broker_version_data, **self.config)
if pop_on_close:
conn.close_future.add_both(lambda _: self._conns.pop(node.node_id, None))
Expand Down
Loading