From eb755b3eadf7448c9716d5add5bdba99ae1490b0 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Sun, 21 Sep 2014 18:53:26 -0700 Subject: Fix SimpleConsumer timeout behavior in get_messages (Issue 237) --- kafka/consumer/simple.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'kafka/consumer/simple.py') 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) -- cgit v1.2.1