Skip to content

allow for timeout to be None in SimpleConsumer.get_messages #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 13, 2013
Merged

allow for timeout to be None in SimpleConsumer.get_messages #77

merged 1 commit into from
Dec 13, 2013

Conversation

zackdever
Copy link
Collaborator

The docstring for get_messages states that None is a valid argument for timeout, but there's a small bug when splitting the timeout between partitions:

TypeError                                 Traceback (most recent call last)
<ipython-input-3-2ff994acfcef> in <module>()
----> 1 for message in consumer.get_messages(count=1, block=True, timeout=None):
      2     print message
      3

/Users/zack/repo/kafka-python/kafka/consumer.py in get_messages(self, count, block, timeout)
    295
    296         # HACK: This splits the timeout between available partitions
--> 297         timeout = timeout * 1.0 / len(self.offsets)
    298
    299         with FetchContext(self, block, timeout):

TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

mumrah added a commit that referenced this pull request Dec 13, 2013
allow for timeout to be None in SimpleConsumer.get_messages
@mumrah mumrah merged commit a306687 into dpkp:master Dec 13, 2013
@mumrah
Copy link
Collaborator

mumrah commented Dec 13, 2013

Looks good, thanks @Zever!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants