Skip to content

Commit 9acbc6f

Browse files
committed
Move BrokerConnection node_id from config to attribute
1 parent d40d106 commit 9acbc6f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kafka/conn.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ def __init__(self, host, port, afi, **configs):
177177
if key in configs:
178178
self.config[key] = configs[key]
179179

180+
self.node_id = self.config.pop('node_id')
181+
180182
if self.config['receive_buffer_bytes'] is not None:
181183
self.config['socket_options'].append(
182184
(socket.SOL_SOCKET, socket.SO_RCVBUF,
@@ -214,7 +216,7 @@ def __init__(self, host, port, afi, **configs):
214216
if self.config['metrics']:
215217
self._sensors = BrokerConnectionMetrics(self.config['metrics'],
216218
self.config['metric_group_prefix'],
217-
self.config['node_id'])
219+
self.node_id)
218220

219221
def connect(self):
220222
"""Attempt to connect and return ConnectionState"""
@@ -904,7 +906,7 @@ def connect():
904906

905907
def __repr__(self):
906908
return "<BrokerConnection node_id=%s host=%s/%s port=%d>" % (
907-
self.config['node_id'], self.hostname, self.host, self.port)
909+
self.node_id, self.hostname, self.host, self.port)
908910

909911

910912
class BrokerConnectionMetrics(object):

0 commit comments

Comments
 (0)