summaryrefslogtreecommitdiff
path: root/kafka/consumer/simple.py
diff options
context:
space:
mode:
authorMark Roberts <wizzat@gmail.com>2014-09-23 14:15:51 -0700
committerMark Roberts <wizzat@gmail.com>2014-09-23 14:15:51 -0700
commit2e3d6dbde0d7c86a6acd0da9fcf55afd9b648fbe (patch)
tree38e04cb88bcff99f21007f9d52b33ffc26331d74 /kafka/consumer/simple.py
parent29f5619385bd26034a21bfb5fd0b827291adb8e4 (diff)
parenteb755b3eadf7448c9716d5add5bdba99ae1490b0 (diff)
downloadkafka-python-2e3d6dbde0d7c86a6acd0da9fcf55afd9b648fbe.tar.gz
Merge pull request #238 from dpkp/simple_consumer_get_messages_timeout
Fix SimpleConsumer timeout behavior in get_messages (Issue 237)
Diffstat (limited to 'kafka/consumer/simple.py')
-rw-r--r--kafka/consumer/simple.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/kafka/consumer/simple.py b/kafka/consumer/simple.py
index dcc71a9..aa4d752 100644
--- a/kafka/consumer/simple.py
+++ b/kafka/consumer/simple.py
@@ -207,10 +207,11 @@ class SimpleConsumer(Consumer):
if not block:
# If we're not blocking, break.
break
- if timeout is not None:
- # If we're blocking and have a timeout, reduce it to the
- # appropriate value
- timeout = max_time - time.time()
+
+ # If we have a timeout, reduce it to the
+ # appropriate value
+ if timeout is not None:
+ timeout = max_time - time.time()
# Update and commit offsets if necessary
self.offsets.update(new_offsets)