diff --git a/kafka/consumer/simple.py b/kafka/consumer/simple.py index dcc71a9d7..b74924bc9 100644 --- a/kafka/consumer/simple.py +++ b/kafka/consumer/simple.py @@ -305,7 +305,7 @@ def _fetch(self): if self.max_buffer_size is None: buffer_size *= 2 else: - buffer_size = max(buffer_size * 2, + buffer_size = min(buffer_size * 2, self.max_buffer_size) log.warn("Fetch size too small, increase to %d (2x) " "and retry", buffer_size)