summaryrefslogtreecommitdiff
path: root/kafka/conn.py
diff options
context:
space:
mode:
authorMarc Labbé <mrlabbe@gmail.com>2014-01-16 18:21:25 -0800
committerMarc Labbé <mrlabbe@gmail.com>2014-01-16 18:21:25 -0800
commit6db14de1673dac9164f8774efdcf01abc2e1a7fb (patch)
treeb22e2042925dfad1cfd8c9495dc5d3bbdf4fb4f7 /kafka/conn.py
parent21e943828b3d4a2916ab2bdc1a79a8298a4f787d (diff)
parentef24c117fee22d4f5ba9f71450974ddad598fafa (diff)
downloadkafka-python-6db14de1673dac9164f8774efdcf01abc2e1a7fb.tar.gz
Merge pull request #107 from rdiomar/fix_default_timeouts
Increase default connection timeout
Diffstat (limited to 'kafka/conn.py')
-rw-r--r--kafka/conn.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/kafka/conn.py b/kafka/conn.py
index f353441..2b8f1c2 100644
--- a/kafka/conn.py
+++ b/kafka/conn.py
@@ -8,6 +8,7 @@ from kafka.common import ConnectionError
log = logging.getLogger("kafka")
+DEFAULT_SOCKET_TIMEOUT_SECONDS = 120
class KafkaConnection(local):
"""
@@ -17,8 +18,13 @@ class KafkaConnection(local):
by a call to `recv` in order to get the correct response. Eventually,
we can do something in here to facilitate multiplexed requests/responses
since the Kafka API includes a correlation id.
+
+ host: the host name or IP address of a kafka broker
+ port: the port number the kafka broker is listening on
+ timeout: default 120. The socket timeout for sending and receiving data
+ in seconds. None means no timeout, so a request can block forever.
"""
- def __init__(self, host, port, timeout=10):
+ def __init__(self, host, port, timeout=DEFAULT_SOCKET_TIMEOUT_SECONDS):
super(KafkaConnection, self).__init__()
self.host = host
self.port = port