diff --git a/kafka/consumer/simple.py b/kafka/consumer/simple.py index dcc71a9d7..aa4d752ef 100644 --- a/kafka/consumer/simple.py +++ b/kafka/consumer/simple.py @@ -207,10 +207,11 @@ def get_messages(self, count=1, block=True, timeout=0.1): 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)