Skip to content

Commit e5a5477

Browse files
committed
Use the same timeout when reinitializing a connection
1 parent e0c45ff commit e5a5477

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kafka/conn.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def __init__(self, host, port, timeout=10):
2525
self.port = port
2626
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
2727
self._sock.connect((host, port))
28-
self._sock.settimeout(timeout)
28+
self.timeout = timeout
29+
self._sock.settimeout(self.timeout)
2930
self._dirty = False
3031

3132
def __str__(self):
@@ -123,5 +124,5 @@ def reinit(self):
123124
self.close()
124125
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
125126
self._sock.connect((self.host, self.port))
126-
self._sock.settimeout(10)
127+
self._sock.settimeout(self.timeout)
127128
self._dirty = False

0 commit comments

Comments
 (0)