Skip to content

Commit

Permalink
Merge pull request dpkp#238 from dpkp/simple_consumer_get_messages_ti…
Browse files Browse the repository at this point in the history
…meout

Fix SimpleConsumer timeout behavior in get_messages (Issue 237)
  • Loading branch information
wizzat committed Sep 23, 2014
2 parents 29f5619 + eb755b3 commit 2e3d6db
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions kafka/consumer/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2e3d6db

Please sign in to comment.