Skip to content

Commit 793dc4d

Browse files
authored
Validate max_records in KafkaConsumer.poll (#1398)
1 parent 4cadaaf commit 793dc4d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kafka/consumer/group.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,8 @@ def poll(self, timeout_ms=0, max_records=None):
595595
assert timeout_ms >= 0, 'Timeout must not be negative'
596596
if max_records is None:
597597
max_records = self.config['max_poll_records']
598+
assert isinstance(max_records, int), 'max_records must be an integer'
599+
assert max_records > 0, 'max_records must be positive'
598600

599601
# Poll for new data until the timeout expires
600602
start = time.time()

0 commit comments

Comments
 (0)