Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions kafka/consumer/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ def _get_message(self, block=True, timeout=0.1, get_partition_info=None,
If get_partition_info is True, returns (partition, message)
If get_partition_info is False, returns message
"""
if get_partition_info is None:
get_partition_info = self.partition_info

if self.queue.empty():
# We're out of messages, go grab some more.
with FetchContext(self, block, timeout):
Expand All @@ -292,14 +295,16 @@ def _get_message(self, block=True, timeout=0.1, get_partition_info=None,
self.count_since_commit += 1
self._auto_commit()

if get_partition_info is None:
get_partition_info = self.partition_info
if get_partition_info:
return partition, message
else:
return message

except Empty:
return None
if get_partition_info:
return None, None
else:
return None

def __iter__(self):
if self.iter_timeout is None:
Expand Down