summaryrefslogtreecommitdiff
path: root/kafka/client.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/client.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/client.py')
-rw-r--r--kafka/client.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/kafka/client.py b/kafka/client.py
index 550da08..155f658 100644
--- a/kafka/client.py
+++ b/kafka/client.py
@@ -10,7 +10,7 @@ from kafka.common import (ErrorMapping, TopicAndPartition,
BrokerResponseError, PartitionUnavailableError,
KafkaUnavailableError, KafkaRequestError)
-from kafka.conn import KafkaConnection
+from kafka.conn import KafkaConnection, DEFAULT_SOCKET_TIMEOUT_SECONDS
from kafka.protocol import KafkaProtocol
log = logging.getLogger("kafka")
@@ -21,7 +21,11 @@ class KafkaClient(object):
CLIENT_ID = "kafka-python"
ID_GEN = count()
- def __init__(self, host, port, client_id=CLIENT_ID, timeout=10):
+ # NOTE: The timeout given to the client should always be greater than the
+ # one passed to SimpleConsumer.get_message(), otherwise you can get a
+ # socket timeout.
+ def __init__(self, host, port, client_id=CLIENT_ID,
+ timeout=DEFAULT_SOCKET_TIMEOUT_SECONDS):
# We need one connection to bootstrap
self.client_id = client_id
self.timeout = timeout