diff options
author | Alex Couture-Beil <alex@mofo.ca> | 2015-01-09 10:54:31 -0800 |
---|---|---|
committer | Alex Couture-Beil <alex@mofo.ca> | 2015-01-09 10:59:42 -0800 |
commit | 9c643e0218b7471fa7f8fd7cd650710c9ba35184 (patch) | |
tree | 6663185a6e1a14a5421dd3e7efd29cdb913abd63 | |
parent | 02c2b469003e2ddcb051dbb4d95977137050c19f (diff) | |
download | kafka-python-9c643e0218b7471fa7f8fd7cd650710c9ba35184.tar.gz |
Randomize start by default for SimpleProducer
random_start=False is dangerous. Any client that initializes a
SimpleProducer and performs only a single publish batch will always go
to partition 0. A common use-case for this is command line utilities,
or web-servers which are unable to cache the SimpleProducer instance
between calls.
-rw-r--r-- | kafka/producer/simple.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kafka/producer/simple.py b/kafka/producer/simple.py index a10fa8c..401b79b 100644 --- a/kafka/producer/simple.py +++ b/kafka/producer/simple.py @@ -42,7 +42,7 @@ class SimpleProducer(Producer): batch_send=False, batch_send_every_n=BATCH_SEND_MSG_COUNT, batch_send_every_t=BATCH_SEND_DEFAULT_INTERVAL, - random_start=False): + random_start=True): self.partition_cycles = {} self.random_start = random_start super(SimpleProducer, self).__init__(client, async, req_acks, |