Skip to content

Commit 914c2e6

Browse files
committed
Merge pull request #161 from maciejkula/bug/timeout_not_respected
Fix connection timeout in KafkaClient and KafkaConnection
2 parents 2415609 + ef4648a commit 914c2e6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

kafka/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _get_conn(self, host, port):
4848

4949
host_key = (host, port)
5050
if host_key not in self.conns:
51-
self.conns[host_key] = KafkaConnection(host, port)
51+
self.conns[host_key] = KafkaConnection(host, port, timeout=self.timeout)
5252

5353
return self.conns[host_key]
5454

kafka/conn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,6 @@ def reinit(self):
150150
"""
151151
self.close()
152152
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
153-
self._sock.connect((self.host, self.port))
154153
self._sock.settimeout(self.timeout)
154+
self._sock.connect((self.host, self.port))
155155
self._dirty = False

0 commit comments

Comments
 (0)